Question: Using java create the following program and post the output. Ethans Car Wash has decided to do a study of their business, which they believe

Using java create the following program and post the output.
Ethans Car Wash has decided to do a study of their business, which they believe has not been as good as they would have liked. Based on some data they have obtained, they assume the following:
Customers arrive at the car wash in random integer intervals of 1 to 5 minutes. That is, when a customer arrives, the next customer will arrive in the next 1 to 5 minutes.
Customers are served in random integer intervals of 2 to 5 minutes. That is, when a car is actually washed, it will take anywhere from 2 to 5 minutes to finish depending on the level of wash that was selected.
The car wash can only hold up to 8 cars waiting to be serviced. If a customer arrives and there are 8 cars waiting, the customer will have to bypass the car wash.
Ethan wants a program to implement a car wash simulation as follows:
1. Initialization:
a. Read in the number of hours and number of minutes for the car wash shift.
b. Read in the number of customers waiting in line when the car wash opens.
2. For each minute of the shift:
a. If the time matches the next customers arrival time
Record the fact that a customer has arrived
if there are less than 8 cars waiting, enqueue the customer and record the arrival time.
Schedule the arrival time for the next customer (in the next 1 to 5 minutes)
b. If the time is the next customers finish time (i.e. the car wash becomes free)
Record the fact that a customer has completed service
Dequeue the next waiting customer
Calculate this customers wait time
Determine this customers service time (1 to 5 minutes) and
Calculate this customers completion time (thus when a new customer can begin service).
3. At the completion of the shift, report the following information:
a. Total number of customers served
b. Number of minutes the car wash was idle
c. Average wait time
d. Longest wait time
e. The number of customers that bypassed the car wash
Ethan wants the program to simulate service for a shift of 8 hours (480 minutes), and of course, see the output. The service line must be implemented as a queue that will contain the customers arrival time (in minutes from the start of the 8 hour period). You must define your own class to implement a queue. // This IS required.
For the input, use three field's, one for input of the hours, one for input of the minutes, and one for the input of the number of cars waiting when the car wash opened. For the output, you may append all output to a simple window.
For testing the program, use a much smaller time period (say 20 minutes), and consider printing a message when a customer arrives, step 2a, and when a customers car has started being serviced, step 2b.
For the project submision, show the results from a simulation of 8 hours. See the posted file

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!