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 (specified as a command line parameter) 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. Here is a sample input file. 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.
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.
Submit your program by emailing your source files (including the makefile) to firstname.lastname@example.org.
Copyright © 2018 Ian Finlayson | Licensed under a Creative Commons Attribution 4.0 International License.