Skip to content

A project I created for school that simulates a line at the bank.

Notifications You must be signed in to change notification settings

MilesSpence/BankSimulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BankSimulation

Project created for class with the following instructions...

DESCRIPTION

For this assignment, you will write a program that simulates a line at a bank. The bank opens at 9 AM and closes at 5 PM. In between, a number of customers arrive throughout the day. Each customer’s business at the bank takes a different amount of time to complete. The bank is small so it only has one teller for all customers. If one customer is at the teller, and others come in, they wait in line in the order they entered.

Your program will read in an input file with one line for each customer. Each line has three fields: customer name, the time they came in (in 24 hour format), and the number of minutes the customer will need with the teller. Customers cannot arrive after the bank closes at 5:00 PM (1700), but if a customer is already in line when the bank closes, they will not be turned away. No two customers will arrive at the same time.

Sample File:
Bob 905 3
Alice 910 7
James 912 4
Marsha 940 2
Reginald 955 7
Bertha 1028 13
Doug 1030 6
Claudia 1038 11
Morehouse 1051 10
Stephen 1104 2
Melinda 1119 8
Albert 1132 3
Edson 1141 10
Bennet 1150 1
Susie 1230 7
Deborah 1259 6
Earl 1304 7
Arthur 1306 4
Curtis 1308 11
Janie 1341 2
Kevin 1345 5
Elsie 1351 3
Alma 1358 2
Dennis 1420 11
Keith 1441 5
Florence 1527 3
Rodney 1555 4
Martin 1605 6
Scott 1609 4
Annie 1617 11
Luis 1624 3
Sonya 1628 5
Mike 1634 2
Iris 1641 4
Mark 1649 7
Sherri 1655 3
Bruce 1659 6

Your program will simulate the activity of the bank in a given day. It will print out the times customers get in line and the times that they are done with their business. Your program will also print out the average waiting time for all customers (including both the time in line and at the teller). Here is the sample output for the input file above.

Bob got in line at 905.
Bob is done at 908.
Alice got in line at 910.
James got in line at 912.
Alice is done at 917.
James is done at 921.
Marsha got in line at 940.
Marsha is done at 942.
Reginald got in line at 955.
Reginald is done at 1002.
Bertha got in line at 1028.
Doug got in line at 1030.
Claudia got in line at 1038.
Bertha is done at 1041.
Doug is done at 1047.
Morehouse got in line at 1051.
Claudia is done at 1058.
Stephen got in line at 1104.
Morehouse is done at 1108.
Stephen is done at 1110.
Melinda got in line at 1119.
Melinda is done at 1127.
Albert got in line at 1132.
Albert is done at 1135.
Edson got in line at 1141.
Bennet got in line at 1150.
Edson is done at 1151.
Bennet is done at 1152.
Susie got in line at 1230.
Susie is done at 1237.
Deborah got in line at 1259.
Earl got in line at 1304.
Deborah is done at 1305.
Arthur got in line at 1306.
Curtis got in line at 1308.
Earl is done at 1312.
Arthur is done at 1316.
Curtis is done at 1327.
Janie got in line at 1341.
Janie is done at 1343.
Kevin got in line at 1345.
Kevin is done at 1350.
Elsie got in line at 1351.
Elsie is done at 1354.
Alma got in line at 1358.
Alma is done at 1400.
Dennis got in line at 1420.
Dennis is done at 1431.
Keith got in line at 1441.
Keith is done at 1446.
Florence got in line at 1527.
Florence is done at 1530.
Rodney got in line at 1555.
Rodney is done at 1559.
Martin got in line at 1605.
Scott got in line at 1609.
Martin is done at 1611.
Scott is done at 1615.
Annie got in line at 1617.
Luis got in line at 1624.
Sonya got in line at 1628.
Annie is done at 1628.
Luis is done at 1631.
Mike got in line at 1634.
Sonya is done at 1636.
Mike is done at 1638.
Iris got in line at 1641.
Iris is done at 1645.
Mark got in line at 1649.
Sherri got in line at 1655.
Mark is done at 1656.
Bruce got in line at 1659.
Sherri is done at 1659.
Bruce is done at 1705.
Average wait time is 1.72973 minutes.

Details

Your program should produce an error message if the user does if the file does not exist.
You must use a queue to store customers that are waiting in line.
The queue must be the stl
You must use functions to processing inputting elements into the queue, processing elements removing from the queue, and reading the file
You can perform the simulation however you like, but I would recommend having a loop that counts through the minutes of the day, from 9:00 on, and decide what must be done each minute.

General Requirements

No global variables other than constants.
Your source code should be readable and reasonably indented.
You must provide comments in your code.

About

A project I created for school that simulates a line at the bank.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published