Enhance the car wash simulation method in Figure 7.8 so that it has the following additional property.

Question:

Enhance the car wash simulation method in Figure 7.8 so that it has the following additional property. There is an additional parameter, which is a maximum length for the queue. When the queue gets as long as this maximum, any customer who arrives will leave without entering the queue (because the customer does not want to wait that long). There should also be one additional simulation result that is printed. In addition to the output shown in Figure 7.8, the method should print the number of simulated customers who left because the queue was too long. Embed the method in a program that allows the user to repeat simulations with different arguments until the user wishes to quit the program.

FIGURE 7.8 Specification and Implementation of the Car Wash Method Specification car WashSimulate public static void carwashSimulate (int washTime, double arrivalProb, int TotalTime) Simulate the running of a car washer for a specified amount of time. Parameters: washTime - the number of seconds required to wash one car arrivalProb -

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: