Woolworths has a sign up that says that if you have to queue at the checkout for longer than 3 minutes, you have waited too long; speak to a manager. Write a program to simulate the queues at Woolworths’ checkouts.
Variables are needed. You need a variable for the number of people joining a queue. Use a variable to hold the time taken to serve a client (on average). You will use the random number generator to generate the average number of people arriving and the average time to be served.
Model the queue mechanism with the following data: between 0 and 5 customers join the queue every minute. It takes between 2 and 8 minutes to serve a client.
What you must do is run the program for a period of time, and calculate how many people are in the queue, and average the amount of time it takes to serve your customers.
When you have the hang of that, add the following features:
Allow for several tills to be open at the same time. Calculate the number of tills you need open to keep the queue to three minutes or less.
Assume that customers always join the shortest queue. (See if it makes any difference if the customer joins a queue at random.)
Add animations of the queue. This need not be complicated. Use stars to represent the queues. For example:
* *
* * *
* * *
* * *
— — —
1 2 3
Credit Blundell@MonktonCoombe