queue to simulate the row of customers through a checkout line in a store. In order to create this simulation, you must model both the passage of time and the row of customers through the line.Java Programming

You need to use a queue to simulate the row of customers through a checkout line in a store. In order to create this simulation, you must model both the passage of time and the row of customers through the line. You can model time using a loop in which each pass corresponds to a set time interval – one minute, for example. You can model the row of customers using a queue in which each element corresponds to a customer in the line.

In order to complete the simulation, you need to know the rate at which customers join the line, as well as the rate at which they are served and leave the line. Suppose the checkout line has the following properties.

  • One customer is served and leaves the line every minute (assuming there is at least onecustomer waiting to be served during that minute).
  • Between zero and four customers join the line every minute according to the followingprobability:
Customer s Arriving Probabilit y
0 0.3
1 0.2
2 0.2
3 0.1
4 0.2
  • You can simulate the row of customers through the line during a time period n minuteslong using the following algorithm:

Initialize the queue to empty.

for ( minute = 0 ; minute < n ; minute++ ) {

If the queue is not empty, then remove the customer at the front of the queue. Compute a random number k. If k is < 0.3, then do not add any customers to the line. If k is < 0.5, then add one customer to the line. If k is < 0.7, then add two customers to the line. If k is < 0.8, then add three customer to the line. Otherwise (if k ≥ 0.8), add four customers to the line.

}

Step 1: Create a program that uses the Java Queue ADT to implement the model described above. Your program should update the following information during each simulated minute, that is, during each pass through the loop:

The total number of customers served

  1. The combined length of time these customers spent waiting in line
  2. The maximum length of time any of these customers spent waiting in line

In order to compute how long a customer waited to be served, you need to store the “minute” that the customer was added to the queue as part of the queue element corresponding to that customer.

Step 2: Use your program to simulate the row of customers through the line and complete the following table. Note that the average wait is the combined waiting time should be derived from the “combined length of time” calculated in step 1 part b. Take special note that, in this program, the length of the simulation is entered by the user.

deliverables:

  • Complete NetBeans project in zip format
  • Video explaining your code (while showing the code in NetBeans)

Attachments:

Instructions Files

Java Programming Experts

expert
Ray Bjork
Java Programming

90 Answers

expert
Neno S.
Java Programming

60 Answers

View More Experts
Disclaimer

The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.

Get Free Quote!

251 Experts Online