Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help figuring this program out I've tried several times but it never turns out the way its supposed to. Create a new class

I need help figuring this program out I've tried several times but it never turns out the way its supposed to.

image text in transcribed
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}: 0 A ride type {e.g., \"Bumper Cars,\" \"Rollercoaster,\" "Carousel\"} o A waiting Queue (those waiting in line} 0 A ride Queue (those actively riding the ride} 0 A maximum capacity (controls how many people can ride) 0 A ride duration (how long the ride takes) 0 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 0 Set the "running\" state to true 0 Sleep for x seconds (where x is the ride's duration) 0 When nished, set the "running\" state to false Inside ThemePark, instantiate ve Amusement objects. Assign each Amusement a type, capacity, and duration. Put the capacity at around 2060 riders at one time o Create a new Queue called \"attendees." Fill this with unique numbers from 11000 0 Start each of the Amusement threads. Have ThemePark checit every second on the "running\" status of each Amusement. If an Amusement is not running, rst 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 ow of riders into the various Queues: Amusement 1 Attendees Amusement 2 Capacity: 40 If the user types \"END,\" stop all of the threads and place the riders baclc into the attendees Queue. Then exit the program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions