Question
Please write this program using Java. Ethans Car Wash has decided to do a study of their business, which they believe has not been as
Please write this program using Java.
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:
Initialization:
Read in the number of hours and number of minutes for the car wash shift.
Read in the number of customers waiting in line when the car wash opens.
For each minute of the shift:
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)
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).
At the completion of the shift, report the following information:
Total number of customers served
Number of minutes the car wash was idle
Average wait time
Longest wait time
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.
Ethan requires that the program be implemented with a GUI. A very simple GUI will suffice. A GUI is NOT required. The GUI is for the Honors project.
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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started