Question: Java Code !!Urgent!! Will give thumb up AmusementPark Program. This program provides a simplified example for an AmusementPark with multiple Attractions and two types of

Java Code !!Urgent!! Will give thumb up

Java Code !!Urgent!! Will give thumb up AmusementPark Program. This program providesa simplified example for an AmusementPark with multiple Attractions and two typesof riders, normal and fast that measures wait times. In order tobetter reflect Object-Oriented principles, much of the actual work takes place insideof the AmusementPark class. Follow the instructions below to implement the requiredcode. In some cases I state how to explicitly create and classifystore certain objects. There is a sample of the input, as wellas the output file at the end of this problem. You willneed to import classes where appropriate. There are a few variables which

AmusementPark Program. This program provides a simplified example for an AmusementPark with multiple Attractions and two types of riders, normal and fast that measures wait times. In order to better reflect Object-Oriented principles, much of the actual work takes place inside of the AmusementPark class. Follow the instructions below to implement the required code. In some cases I state how to explicitly create and classify store certain objects. There is a sample of the input, as well as the output file at the end of this problem. You will need to import classes where appropriate. There are a few variables which are included only to check that you fully understand abstract classes and methods, even though they have no other purpose. Note: Simulated time simply means the minute starting from zero in the simulation. Draw the UML diagram for the Rider, NormalRider and FastRider classes, and the TicketPrice interface as described in the program below. Be sure to use the correct connector types. (10) interface Ticket Price (5) This interface includes; A BASEPRICE of type double set to 15.75 A setTicketPrice method with no parameters and a void return value. A getTicketPrice method with no parameters and a double return value. Neither method is implemented as a default method in this interface. class Rider (10) Rider is an abstract class. It has three int instance variables: startOnlineTime - the simulated time the rider gets on a line end Online Time - the simulated time the rider gets on the ride timeOnLine the amount of simulated time the rider waits on a line It has two constructors: There is a default constructor that does nothing There is a constructor with a single parameter that indicates the minute the Rider gets on a line. This constructor calls the mutator to setStartOnline Time. There are the following methods: There are accessors for all three values. There is a setStartOnline Time mutator that accepts a simulated time and sets startOnline Time. There is a method setEndOnLine Time that accepts the end of the time on the line. It sets the end Online Time and then calculates and sets the timeOnLine. There are two abstract methods. setType has no parameters and returns nothing. getType has no parameters but returns an int. class NormalRider (10) - Someone who pays a little less but may have to wait longer. NormalRider is a non-abstract class that extends Rider and implements TicketPrice It has two additional instance variables: ticketPrice which is of type double type which is an int. There are two constructors: There is a default constructor that does nothing. There is a constructor with a single parameter that indicates the simulated minute the Rider gets on a line. This constructor uses super and then also call setType with no parameters. There are the following methods: There are accessors for both additional instance values that implement the abstract methods: getTicketPrice implements the abstract method from TicketPrice getType implements the abstract method in Rider and returns the value of type setTicketPrice implements the abstract method in TicketPrice and sets the ticketPrice to the BASEPRICE setType implements the abstract method from Rider. It creates a Random object and then uses it to set the type variable to a value of between 1 and 5. class FastRider (10) - Someone who pays extra to wait less time FastRider is a non-abstract class that extends Rider and implements TicketPrice It has two additional instance variables: ticketPrice which is a double type which is an int. There are two constructors: There is a default constructor that does nothing. There is a constructor with a single parameter that indicates the minute the Rider gets on a line. This constructor uses super and then also call setType with no parameters. There are the following methods: There are accessors for both additional instance values: getTicketPrice implements the abstract method from TicketPrice getType implements the abstract method in Rider and returns the value of type setTicketPrice implements the abstract method in Ticket Price and sets the ticket Price to 20% more than the BASEPRICE setType implements the abstract method from Rider. It creates a Random object and then uses it to set the type variable to a value of between 1 and 10. class Attraction (25) Attraction is a class which simulates the queues with various riders waiting to get on an Attraction, as well as keeping track of who got on the ride. The instance variables are: A static int attraction Counter initially set to zero A String attractionID An int ratePerMinute for the Attraction An ArrayList called alNormalLine of type NormalRider that can hold references to NormalRider objects An ArrayList called alFastLine of type FastRider that can hold references to FastRider objects An ArrayList called alGotOnRide of type Rider that can hold references to Rider objects and objects NormalRider and FastRider objects It contains the following constructors: A default constructor that sets attraction ID to the empty String A constructor with a single parameter for the ratePer Minute that: Calls the mutator setRatePerMinute with the rate Per Minute parameter Calls mutator setAttraction ID with no parameters. Has the following methods: Mutator setRatePerMinute accepts an int value and sets the ratePerMinute Mutator setAttractionID has no parameters. It Increments attraction Counter by 1 Sets the variable attractionID to the concatenation of RIDE and the attraction Counter value Accessor methods for both of the above values. FastRider object, respectively, to the ArrayList. The NormalRider or FastRider is the parameter. (Can call the methods addRider NormalLine and addRiderFastLine) For ArrayLists alNormalline and alFastLine provides methods that removes a NormalRider or FastRider object respectively from the ArrayList. The removal should be from the front of the ArrayList, that is the OTH position. (Can call the methods removeRiderNormalLine and removeRiderFastLine). These methods return references to the NormalRider or FastRider respectively There should be for each of the two ArrayLists above a method that can return as an int the size of the array. They can be called getAINormalLine Size and getAlFastLine Size There should also be a method addGotonRide that adds a Rider of any type to the ArrayList alGotOnRide. There should also be a method getGotOnRide with an int parameter that returns a Rider of any type from the ArrayList alGotOnRide at index i but doesn't remove it. There should also be a method getAIGotOnRideSize that returns the size of alGotOnRide. class AmusementPark (50) The class that simulates the AmusementPark model This class creates riders, manages the queues for the attractions and prints out statistics in the end. Remember to import proper classes, including necessary 10 classes There are 3 instance variables: A String with the park Name An int numAttractions with the number of Attractions in the park An ArrayList alAttraction of type Attraction containing references to the Attractions in the AmusementPark. There are two constructors: The default constructor calls: setParkName with the empty String as the parameter which will set the park Name setNumAttractions with a value of 0 as the parameter (sets numAttractions to 0) create Attractions with a value of 0 as the parameter The second constructor has parameters for the name (String) and numAttractions (int) and calls: setParkName with the park Name as the parameter which will set the park Name setNumAttractions with a value of equal to the second parameter that sets the numAttractions create Attractions with a value of numAttractions The following methods are provided The obvious accessor and mutator methods are provided to set and get the park Name and numAttractions. The create Attractions method accepts the number of attractions It creates a Random object with a seed of 2 For each attraction Calculate the ratePer Minute for the attraction as between 10 and 15 riders per minute Create an Attraction object using this ratePer Minute Add the Attraction to the ArrayList alAttraction The runThePark method accepts a duration in minutes as the input parameter and does the following: Note: create temporary local variables as necessary. Calculate the initialRiders as 23*num Attractions for each initialRider (j=0; j 0 if the alFastLine for the Attraction is not empty and toBeProcessed is not divisible by 3 Remove a FastRider from alFastLine of the Attraction Call setEndOnLineTime for the FastRider removed with the current time Call addGotOnRide for the Attraction with a reference to the FastRider Decrement toBeProcessed by one else if the alNormalLine for the Attraction is not empty Remove a NormalRider from alNormaLine of the Attraction Call setEndOnLineTime for the NormalRider removed with the current time Call addGotOnRide for the Attraction with a reference to the FastRider Decrement toBeProcessed by one else set toBeProcessed equal to 0 The printParkStatistics method accepts a reference to a Print Writer (Note must also throw an IOException) Look at the sample out below: Print out a Header Line: The Statistics for parkName Print out the statistics for each Attraction as shown in the sample below. The Statistics for BEHESHTI JAVALAND Statistics for Attraction RIDE 1 The total number that got onto the ride is 840 There were 600 Fast Riders who got on waiting an average of 1.00 minutes There were 240 Normal Riders who got on waiting an average of 21.76 minutes There were 840 Total Riders who got on waiting an average of 6.93 minutes Statistics for Attraction RIDE2 The total number that got onto the ride is 600 There were 420 Fast Riders who got on waiting an average of 10.00 minutes There were 180 Normal Riders who got on waiting an average of 24.07 minutes There were 600 Total Riders who got on waiting an average of 14.22 minutes Statistics for Attraction RIDE3 The total number that got onto the ride is 720 There were 480 Fast Riders who got on waiting an average of 7.00 minutes There were 240 Normal Riders who got on waiting an average of 21.76 minutes There were 720 Total Riders who got on waiting an average of 11.92 minutes Statistics for Attraction RIDE4 The total number that got onto the ride is 660 There were 480 Fast Riders who got on waiting an average of 7.00 minutes There were 180 Normal Riders who got on waiting an average of 24.07 minutes There were 660 Total Riders who got on waiting an average of 11.66 minutes Statistics for Attraction RIDES The total number that got onto the ride is 780 There were 540 Fast Riders who got on waiting an average of 4.00 minutes There were 240 Normal Riders who got on waiting an average of 21.76 minutes There were 780 Total Riders who got on waiting an average of 9.47 minutes class SimulatePark (10) This class which includes main does the following: Creates a Scanner to read from the terminal. Read in the name of the AmusementPark. Read in a number of attractions between 3 and 10 inchusively, excluding 7. (loop if value incorrect) Create a single AmusementPark with the name and number of rides you have read in. Read in a duration for the simulation of at least 60 minutes. (loop if value incorrect) Call runThePark for the created AmusementPark with the parameter value of the duration of the simulation Create a Print Writer object (remember to import correct classes and that you need to throw an IOException). You must request the name of the file to write to. Call printParkStatistics with a reference to the Print Writer object. Close the Print Writer object. Sample Input/Output From The Terminal Please enter the name of Amusement Park: Behesti Javaland Please enter the number of attractions Number must be between 3 and 10 inclusively, excluding 7:5 Please enter the duration of the simulation in minutes Must enter 60 minutes or greater: 60 Please enter the name of the output file: amusestats.txt A Sample Output File The Statistics for BEHESHTI JAVALAND Statistics for Attraction RIDE1 The total number that got onto the ride is 840 There were 600 Fast Riders who got on waiting an average of 1.00 minutes There were 240 Normal Riders who got on waiting an average of 21.76 minutes There were 840 Total Riders who got on waiting an average of 6.93 minutes Statistics for Attraction RIDE2 The total number that got onto the ride is 600 There were 420 Fast Riders who got on waiting an average of 10.00 minutes There were 180 Normal Riders who got on waiting an average of 24.07 minutes There were 600 Total Riders who got on waiting an average of 14.22 minutes Statistics for Attraction RIDE3 The total number that got onto the ride is 720 There were 480 Fast Riders who got on waiting an average of 7.00 minutes There were 240 Normal Riders who got on waiting an average of 21.76 minutes There were 720 Total Riders who got on waiting an average of 11.92 minutes Statistics for Attraction RIDE 4 The total number that got onto the ride is 660 There were 480 Fast Riders who got on waiting an average of 7.00 minutes There were 180 Normal Riders who got on waiting an average of 24.07 minutes There were 660 Total Riders who got on waiting an average of 11.66 minutes Statistics for Attraction RIDES The total number that got onto the ride is 780 There were 540 Fast Riders who got on waiting an average of 4.00 minutes There were 240 Normal Riders who got on waiting an average of 21.76 minutes There were 780 Total

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!