Question
In Python: Write a supermarket cashier line simulation program based on the queue class implementation discussed in the lecture that operates under the following rules:
In Python: Write a supermarket cashier line simulation program based on the queue class implementation discussed in the lecture that operates under the following rules: 1. The cashier line starts with a single line. 2. If the length of the queue reaches 6, a second cashier line is opened and so on. 3. If the length of a queue reaches zero and 1 minute has passed since the queue length has reached zero then the cashier closes. (print a message: Cashier Closed) 4. Simulate the following scenarios: a. Assume the queue is initialized to 3 people at the beginning. People are coming at the rate of 2/min and leaving at the rate of 1/min. What is the status of the queue/queues after 10 minutes (how many queues and how many people in each)? b. Assume the queue is initialized to 3 people at the beginning. People are coming at the rate of 2/min and leaving at the rate of 3/min. What is the status of the queue/queues after 2 & 5 minutes? c. Print the number of people in each queue at every minute. d. You do not have to simulate the queue based on the actual time (no timer is needed). Use the times to calculate what happens to the queue, i.e. what is the enqueue and dequeue rates and them simulate the queues by instantiating the queue objects. In summary you want to implement the following table using Queue objects for case a.
Follow through with building a table for case b and implement using queue objects. The following table shows the progress of the queues and the number of people in case a:
Time ti Q2 03 (minutes) Closed Closed Closed Closed 1 (2-1) 4 (3 +2-1) 5 (4 +2-1) 2 10 Closed 1 (2-1)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