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.
Customer s Arriving | Probabilit y |
0 | 0.3 |
1 | 0.2 |
2 | 0.2 |
3 | 0.1 |
4 | 0.2 |
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
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:
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme