The fancy new French restaurant La Food is very popular for its authentic cuisine and high prices. This restaurant does not take reservations. To help improve the efficiency of their operations, the Maitre De has hired you to write a program that simulates people waiting for tables. The goal is to determine the average amount of time people spend waiting for tables.
The fancy new French restaurant La Foodis very popular for its authentic cuisine and high prices. This restaurant does not take reservations. To help improve the efficiency of their operations, the Maitre De has hired you to write a program that simulates people waiting for tables. The goal is to determine the average amount of time people spend waiting for tables.
Your program will read in a list of event descriptions from a text file, one description per line.
• Arrival: A party has arrived to eat. Add them to the end of the list of waiting parties (a Queue) and tell them to wait at the bar (where strong drinks are served) until called. This event is described in the following format:
At n name
Here t is the time of arrival (in minutes past opening time), n is the number of people in the party, and name is the name to call when the table is ready.
• Table: A table has become available; remove the party that has been waiting the longest from your list, and seat them. This event is described in the following form:
Tt
Here t is the time the table became available (again, in minutes past opening time),
• Quit: This is a sentinel event indicating the end of the input file. It has the following form:
Q
When the events in the file have been processed, compute and print the average waiting time per customer. If there are still people waiting for tables, print a summary of who is still waiting.