// random initializing of rand()// line queue holds up to qs peopleint hours:cin >> hours://

// random initializing of rand()

// line queue holds up to qs people

int hours:
cin >> hours:

// average # of arrival per hour

// average time between arrivals

1/

new customer data
turned away by full queue
// joined the queue
served during the simulation
cumulative line length
// time until autoteller is free
cumulative time in line

-

// cycle = time of arrival

using std :: cin;
using std :: cout;
using std :: endl;
using std :: ios_base;
// setting things up
std :: srand (std :: time (0)):

cout << "Case Study: Bank of Heather Automatic Teller
";
cout << "Enter maximum size of queue: ";
int qs:
cin >> qs:
Queue line (qs);

cout << "Enter the number of simulation hours: ";
// hours of simulation

// simulation will run 1 cycle per minute
long cyclelimit = MIN_PER_HR * hours: // # of cycles

cout << "Enter the average number of customers per hour: ":
double perhour:
cin >> perhour:
double min_per_cust:
min_per_cust = MIN_PER_HR / perhour:

Item temp:
long turnaways = 0:
long customers = 0:
long served = 0:
long sum_line = 0:
int wait time = 0:
long line wait = 0:

// running the simulation
for (int cycle = 0; cycle < cyclelimit: cycle++)

if (newcustomer (min_per_cust)) // have newcomer

if (line.isfull())
turnaways++:
else

customers++:
temp.set (cycle);
line.enqueue (temp): // add newcomer to line

// attend next customer

-

if (wait_time <= 0 66 !line. isempty ())

line.dequeue (temp);
wait_time = temp.ptime(): // for wait_time minutes
line_wait += cycle - temp.when ():
served++:

if (wait_time > 0)
wait_time --:
sum_line += line.queuecount ():

// reporting results