The La Food Restaurant Program SOlution

$35.00 $24.00

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…

You’ll get a: . zip file solution

 

 
Categorys:

Description

5/5 – (2 votes)

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 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:

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.

  • 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:

T t

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.

Sample Data File

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!

Hand In

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.

Extra Credit (5 points)

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.

Notes

  • Remember to include comments at the top of your program and 1-2 lines for each function (including pre- and post-conditions). Use javadoc compatible comments.
  • Use a version of the Queue class we wrote in class. Declare a class Party to hold one party.
  • Read one line of the text file, and then process it, before moving on to the next line. Do not try to read in the entire file before processing it. Reading the text file is probably the trickiest part of this assignment.
  • To compute the average waiting time, keep track of the total number of people seated, and keep track of the total time spent waiting using something like this:

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.

  • Start right away!