Menu
support@authoritypapers.com
+1(805) 568 7317

dynamic queues supermarket lines in java a supermarket wants to test how well their 5187979

Dynamic Queues: Supermarket Lines In JAVA

A supermarket wants to test how well their store will function with different number of cashiers serving customers. Write a program that simulates that situation using queues. First, your program should ask how many cashiers will be serving customers. You should make sure that the number entered is between 1 and 5. For each simulated minute you should generate a random number of buyers (between 0 and 3), each buyer takes from 2 to 6 minutes to be served (generate the number of service minutes randomly). Customers are served on a first-come first serve basis. A customer will stay with a cashier until the time required has elapsed, then the cashier can serve then next customer. The simulation ends when no cashiers are busy and no people enter the store.

Your program should print information about when a cashier starts serving a customer and when the customer is finished and leaves and should work in units of one minute intervals. A Sample run follows:

How many cashiers ? 3

Simulation time is 1

Customer 1 required service time: 6

Customer 2 required service time: 3

Customer 1 being served by Cashier 1

Customer 2 being served by Cashier 2

Simulation time is 2

Customer 3 required service time: 5

Customer 4 required service time: 1

Customer 5 required service time: 1

Customer 3 is being served by Cashier 3

Simulation time is 3

Customer 6 required service time: 4

Customer 2 is leaving the store

Simulation time is 4

Customer 4 is being served by Cashier 2

Customer 4 is leaving the store

Create a program that implements the described model. Your program should update the following information during each simulated minute:

The total number of customers served

The combined length of time these customers spent waiting in line

The maximum length of time any of these customers spent waiting in line

Use your program to simulate the flow of customers through the line and complete the following table.

Time (minutes)   Number of customers served       Average wait       Longest wait

Hints

The size of the queues is not known. You should implement them as linked lists

"Order a similar paper and get 15% discount on your first order with us
Use the following coupon
"GET15"

Order Now