I need a program that will simulate a Queue at a checkout counter.
The algorithm to use to
implement of the Queue should be a doubly-linked list. Each person in the Queue should be assigned a number. There are two things that need to happen:
The first is to Enter the Queue, i.e. to be added to
the end of the list of people waiting to be served. The second is to be
Served when the person reaches the most senior position in the Queue.
After being Served, the person is removed/deleted from the Queue (and he/she goes
on his/her way).
There will also be 3 user inputs:
1) The user can choose how long the program runs through the queue, a length of time in minutes for which the
simulation is to be run. This is a positive integer which will be
used to specify the number of minutes for which your simulation should be run.
I expect to be able to run the simulation for anywhere between 10 minutes and
60 minutes. When I say that I want the
simulation to run for 10 minutes, I don’t mean that it should run for ten
minutes of elapsed clock time using wait, sleep or pause to consume the
time. What I mean is that it is to
proceed through all the calculations to present its results without stopping
for waits, sleeps or pauses.
the user puts in the maximum interval in minutes between individual people entering the
Queue. For instance, if 5 minutes is the maximum, a person can enter the
Queue at 1,2,3,4 or 5 minutes following the admission of the immediate
predecessor. You may assume that the first person enters the Queue during
the minute when the Queue is first opened.
You can use an application of the
function rand() to determine the interval after each person has entered
the queue before the next person enters. You can also use srand()
once in the program execution to prime the random number
generator. If you use srand(),
you need to provide for the user to enter an integer seed number.
3) The user also puts the maximum interval of time in minutes to serve an individual
person in the Queue when the person reaches the front of the Queue.
For instance, if the maximum time to serve any customer is 3 minutes, then a particular
customer may be served in 1, 2 or 3 minutes. You can also use an
application of the rand()
function to determine this interval of time for service, not including
preceding wait time.
Output wanted is is a table of the current
minute number, the customer number starting with 1, the entry minute for each
customer and the remaining minutes to exit for each customer set up as a table. Output should look similar to this: https://gyazo.com/718af72c63b53e03b47102a91784f95b