# I need a program that will simulate a Queue at a checkout counter

Nov 9th, 2015
Anonymous
Category:
Programming
Price: \$100 USD

Question description

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.

2) 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

(Top Tutor) barnes
School: Purdue University

Studypool has helped 1,244,100 students

Review from student
Anonymous
" Excellent job "

Type your question here (or upload an image)

1820 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors