Your cart is currently empty!
Description 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…
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.
Your program will read in a list of event descriptions from a text file, one description per line.
A t 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.
T t
Here t is the time the table became available (again, in minutes past opening time),
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.
Here is a sample data file. You may use this if you like, or you can make up your own.
A 3 3 Merlin
A 8 2 Arthur Pendragon
T 10
A 12 2 Sir Lancelot
T 15
A 17 3 The Green Knight
T 20
Q
Here is the corresponding output from the simulator program. The user’s input appears in italics.
*** Welcome to the La Food Restaurant Simulator ***
Enter data file name: data.txt
Please wait at the bar,
party Merlin of 3 people. (time=3)
Please wait at the bar,
party Arthur Pendragon of 2 people. (time=8)
Table for Merlin! (time=10)
Please wait at the bar,
party Sir Lancelot of 2 people. (time=12)
Table for Arthur Pendragon! (time=15)
Please wait at the bar,
party The Green Knight of 3 people. (time=17)
Table for Sir Lancelot! (time=20)
** Simulation Terminated **
The average waiting time was: 7.28
The following parties were never seated:
party The Green Knight of 3 people
Have a nice meal!
Turn in a listing of your program, a sample run, and a printout of your data file if you did not use the one above.
Be sure to include everyone’s name in the comments at the top of your program. I expect you to use the Queue interface and implementation files from class; it should not be necessary to change them in any way. If you do change them, and you’re not doing the extra credit (see below), it is likely you are doing something wrong.
Modify the A command to include a tip/bribe for the Maitre De. The new format would then be
A t n b name
where b is the amount of the bribe, in Euros, of course. A party is then placed in line ahead of everyone who gave a lesser bribe. Two parties that bribe the same amount are placed in order of arrival.
Modify the input file to include bribes for a sample run, and print the total bribe money collected as part of the final summary.
Note: This is not trivial. Do not start this until the rest is working correctly. You will have to change some aspects of the Queue implementation to get this to work.
totmins = totmins + partysize*(tos – toa)
where tos is the time of seating, and toa is the time of arrival. Since you need to know both times, this must be done when the party is seated.