Question: Need help with this Python Exercise PLEASE DO NOT COPY CODE FROM OTHER QUESTIONS POSTED WITH THIS. Follow the steps provided below: Create a simple

Need help with this Python Exercise

PLEASE DO NOT COPY CODE FROM OTHER QUESTIONS POSTED WITH THIS.

Follow the steps provided below:

Create a simple multi-thread program in PYTHON(ONLY) to simulate a checkout in grocery store/supermarket.

The process of simulation will last for T1 seconds.

You do not need to consider thread safety.

An integer sequence t is used to record the remaining waiting time for each customer.

One thread which runs every one second is used to simulate the processing of the checkout.

(1) Reduce the remaining processing time of the first customer by one.

(2) Remove the first customer if his remaining processing time reaches zero.

(3) Clean the screen and show the new remaining processing time. 4.

Another thread is used to generate one new customer every T2 seconds.

(1) The new customer will leave the supermarket if he or she needs to join a queue with more than R customers.

(2) The processing time for the new customer is a random integer in [Tmin; Tmax) 5.

An example program run is shown as follows.

Checkout: 3 12 45 5 61, after one second, we have:

Checkout: 2 12 45 5 61, after one second, we have:

Checkout: 1 12 45 5 61 22, after one second, we have:

Checkout: 12 45 5 61 22, after one second, we have:

Checkout: 11 45 5 61 22

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!