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.

Task 2

When you have the hang of that, add the following features:

  1. 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.
  2. Assume that customers always join the shortest queue.  (See if it makes any difference if the customer joins a queue at random.)
  3. Add animations of the queue.  This need not be complicated.  Use stars to represent the queues.
  4. Allow the user to vary: the number of clients joining the queue, the number of queues, the rate at which customers are served.

Credit Blundell@MonktonCoombe

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.