Homework Four
Simulating a line at a Bank
Due: Tuesday February 22

A bank is considering purchasing a new computer system that will improve the processing time of tellers. Currently, a teller takes exactly ten minutes to process each customer's request. The company selling the new computer system promises that teller response time will improve to eight minutes per customer.

Your task is to determine the impact that such a system would have. Specifically, how much would line size and waiting times decrease?

Previous studies by the bank have determined that customers arrive more around noon-time, than at other times of the day. Specific arrival rates are:

    09:00 to 10:30    every 10 to 15 minutes
    10:31 to 13:00    every 7 to 12 minutes
    13:01 to 16:00    every 9 to 13 minutes
In other words, the bank opens at 9:00am and the first customer comes in 10 to 15 minutes later, then the next customer 10 to 15 minutes after that time, etc. So, if a random number generator returned a 12 then a 14, the first two customers would arrive at 9:12 and 9:26.

Assume that there is only one line and one teller for this bank. Also assume that anyone in line when the bank closes at 4:00pm (16:00) is told to leave.

Create a program that conducts two simulations. One simulation with a teller time of 10 minutes then a second simulation with a teller time of 8 minutes.

For both simulations, gather the following stats:
The longest the line ever grew to?
The longest amount of time waited (among those who got service)?
The average time people spent in line (among those who got service)?
The number of people in line at closing time?

Hints:

Here is a c++ program that I wrote that tests a random number generation formula.

Here is a copy of the debugging statements from my simulation for the first two hours of bank operation. Your random numbers may differ, hence your times may differ.

Use lots of print statements!!! Print a message every time someone gets in line or leaves the line. When someone gets in line, print a message indicating the time of day that the next person is expected to arrive. print, print, print!

Go slow!!! Don't start with a queue. First just write a program that will determine when people should show up. Once you have that loop working correctly and the random numbers working correctly, then see if you can enqueue, then see if you can dequeue. Go slow and print every significant variable every time through the loop.

Test your queue class with a separate small program. For example, try enqueueing four numbers, then dequeueing twice, then enqueueing three more times, then dequeue four times, etc. just to make sure the order is correct.

Did I mention that you should use LOTS of print statements?