Don’t use chegg or coursehero Programming Assignment 7 Theme Parks and Threads ?? Amusement parks are a lot of fun, but everyone agrees the worst part of the experience is waiting. Some com
Don't use chegg or coursehero
Programming Assignment 7 – Theme Parks and Threads
Amusement parks are a lot of fun, but everyone agrees the worst part of the experience is waiting.
Some companies invest in a lot of clever systems to help manage and control their lines more efficiently.
To see behind the scenes at how Disney does this, check out:
https://www.nytimes.com/2010/12/28/business/media/28disney.html
Now we’re going to create our own command station that uses threads to activate and track rider
movement throughout a bustling amusement park.
Program Requirements
• Create a new class called “ThemePark.” Inside it, put your main program. This program will
manage and monitor all the theme park rides in the park. ThemePark should extend Thread.
• Create a new class called “Amusement.” This class should extend Thread. This class will have the
following variables and methods to access them. (Remember to use proper Object-Oriented
design in its creation):
o A ride type (e.g., “Bumper Cars,” “Rollercoaster,” “Carousel”)
o A waiting Queue (those waiting in line)
o A ride Queue (those actively riding the ride)
o A maximum capacity (controls how many people can ride)
o A ride duration (how long the ride takes)
o A running Boolean (is the ride running? True/false) – initially set to false
• Override the run() function inside your “Amusement” class. This function should do the
following
o Set the “running” state to true
o Sleep for x seconds (where x is the ride’s duration)
o When finished, set the “running” state to false
• Inside ThemePark, instantiate five Amusement objects. Assign each Amusement a type,
capacity, and duration. Put the capacity at around 20–60 riders at one time
o Create a new Queue called “attendees.” Fill this with unique numbers from 1–1000
o Start each of the Amusement threads. Have ThemePark check every second on the
“running” status of each Amusement. If an Amusement is not running, first put all of
the riders in the Amusement’s ride Queue into the “attendees” Queue. Put the
maximum number of riders from the ride’s waiting Queue into the ride Queue. Finally,
take a set number of riders from the “attendees” Queue and place them in the
Amusement’s waiting Queue
Note: here is a diagram to help you make sense of the flow of riders into the various
Queues:
• If the user types “END,” stop all of the threads and place the riders back into the attendees
Queue. Then exit the program
Include appropriate comments throughout your code. Remember to use standard Java naming
conventions. Put your name and description of the program in the comments at the top. Submit your
ThemePark, Amusement, and all associated project Java and class files, as well as a screenshot of it in
operation on your computer. Package all of these in a zip file and name the submission in the format:
NAME_COURSE_ASSIGNMENT_DATE.zip
Submission is due by 11:59 p.m. ET.
• If the user types “END,” stop all of the threads and place the riders back into the attendees
Queue. Then exit the program
Include appropriate comments throughout your code. Remember to use standard Java naming
conventions. Put your name and description of the program in the comments at the top. Submit your
ThemePark, Amusement, and all associated project Java and class files, as well as a screenshot of it in
operation on your computer. Package all of these in a zip file and name the submission in the format:
NAME_COURSE_ASSIGNMENT_DATE.zip
Programming Assignment 7 – Theme Parks and Threads
Amusement parks are a lot of fun, but everyone agrees the worst part of the experience is waiting.
Some companies invest in a lot of clever systems to help manage and control their lines more efficiently.
To see behind the scenes at how Disney does this, check out:
https://www.nytimes.com/2010/12/28/business/media/28disney.html
Now we’re going to create our own command station that uses threads to activate and track rider
movement throughout a bustling amusement park.
Program Requirements
• Create a new class called “ThemePark.” Inside it, put your main program. This program will
manage and monitor all the theme park rides in the park. ThemePark should extend Thread.
• Create a new class called “Amusement.” This class should extend Thread. This class will have the
following variables and methods to access them. (Remember to use proper Object-Oriented
design in its creation):
o A ride type (e.g., “Bumper Cars,” “Rollercoaster,” “Carousel”)
o A waiting Queue (those waiting in line)
o A ride Queue (those actively riding the ride)
o A maximum capacity (controls how many people can ride)
o A ride duration (how long the ride takes)
o A running Boolean (is the ride running? True/false) – initially set to false
• Override the run() function inside your “Amusement” class. This function should do the
following
o Set the “running” state to true
o Sleep for x seconds (where x is the ride’s duration)
o When finished, set the “running” state to false
• Inside ThemePark, instantiate five Amusement objects. Assign each Amusement a type,
capacity, and duration. Put the capacity at around 20–60 riders at one time
o Create a new Queue called “attendees.” Fill this with unique numbers from 1–1000
o Start each of the Amusement threads. Have ThemePark check every second on the
“running” status of each Amusement. If an Amusement is not running, first put all of
the riders in the Amusement’s ride Queue into the “attendees” Queue. Put the
maximum number of riders from the ride’s waiting Queue into the ride Queue. Finally,
take a set number of riders from the “attendees” Queue and place them in the
Amusement’s waiting Queue
Note: here is a diagram to help you make sense of the flow of riders into the various
Queues:
• If the user types “END,” stop all of the threads and place the riders back into the attendees
Queue. Then exit the program
Include appropriate comments throughout your code. Remember to use standard Java naming
conventions. Put your name and description of the program in the comments at the top. Submit your
ThemePark, Amusement, and all associated project Java and class files, as well as a screenshot of it in
operation on your computer. Package all of these in a zip file and name the submission in the format:
NAME_COURSE_ASSIGNMENT_DATE.zip
Submission is due by 11:59 p.m. ET.
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.