Develop a queue class

Assignment Help JAVA Programming
Reference no: EM13179744

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: At name Here tis 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 tis 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 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!

Notes

1. Before you begin programming, sketch a high level design of what you want to implement using the UML notation. At the very least, you should have a use case diagram, class diagram (for the Party class) and a sequence diagram.

2. Remember to include comments at the top of your program and 1-2 lines for each function (including pre- and post-conditions). Use javadoccompatible comments.

3. Develop a Queue class. Hint: Check out the sample Queue java source files included with this assignment. Declare a class Party to hold one party.

4. 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.

5. 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) wheretosis the time of seating, and toais the time of arrival. Since you need to know both times, this must be done when the party is seated.

6. Start right away! Hand In

1. Listing (print-out) of your nicely formatted program source code (with comments and headers)

2. Print-out of the text file that contains your restaurant information

3. Screen captures of at least three sample runs/scenario output

4. High level design using UML notation (minimum of a use case diagram, a class diagram for Party class, & a sequence diagram)

5. Utilize the submission template provided in the course module.

Reference no: EM13179744

Questions Cloud

Fuel cells produce energy from hydrogen : Fuel cells produce energy from hydrogen by:
Compute the percentage ionization of benzoic acid : calculate the percentage ionization of benzoic acid at the following concentration : assume the approximation for both cases to be correct : a) 0.20M b) .0.00020M
Describe major elements of recent federal approaches : Describe the major elements of recent federal approaches to the enforcement of our drug laws, and indicate some of the enormous difficulties and apparently positive consequences associated with those approaches?
Determine the ph of a slution prepered by acetic acid : Determine the ph ( to 1 decimal place) of a slution prepered by adding 125ml of 0.759M acetic acid to 10.3g of sodium acetate. the pKa of acetic asid is in table 10.2. Assume the volume of the solution does not change?
Develop a queue class : Print-out of the text file that contains your restaurant information and develop a Queue class. Hint: Check out the sample Queue java source files included with this assignment. Declare a class Party to hold one party.
What your toughts on business that are too big to fail : What your toughts on business that are too big to fail? do you think the government should faclitate then with bail out money when they get into trouble or just let them fail?
Should she buy less sushi and more soy milk : the origin and do not intersect the axes. The price of sushi is $10 and the price of soy milk is $2. She is spending all her income at the basket she is currently consuming, and her marginal rate of substitution of sushi for soy milk is 4. Is she ..
Find the derivatives : Please show work step by step. Find the derivatives of.
State carbon-dating evaluate the ratio of radioactive carbon : Carbon-dating evaluates the ratio of radioactive carbon-14 to stable carbon-12. Given the amount of carbon-12 contained a measured sample cut from the document, there would have been about 1.3 × 10-12 grams of carbon-14 in the sample when the parc..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Develop java code to compute monthly rent for housing units

Develop a java code that computes monthly rent for 3 housing units namely Bungalows,Apartments and hostels. All housing units have got size,color and monthly rental rate.

  Create a java program

UserApp and PrettyPrintUtility multiple times (supplying different TransData test file names), the AutoTesterUtility PROGRAM will be the driver program.

  Create four classes

Create four classes: Account.java, Checking.java, Savings.java, and AccountArray.java.

  Implement a method with three arguments

Implement a method with three arguments: a graph, a starting vertex number, and an ending vertex number. The method determines whether there is a directed path from the starting vertex to the ending vertex.

  Write a class that implements an ordered list of strings

In this problem you will write a class that implements an ordered list of Strings.

  Implement 4 sorting algorithms in a java "sort" class.

Implement 4 sorting algorithms in a Java " Sort " class. ( insertion sort, selection sort and quicksort, and mergesort). count the number of comparisons made.

  Object-oriented gui drawing editor

A simple object-oriented GUI drawing editor that allows a user to create, move and erase rectangles, squares, circles and lines in an interactive graphics. How can I draw move erase rectangles, squares, circles and lines in GUI/java.

  Create a method that would search through an arraylist

What is the best way of the following ways (For each, Iterator, While with index) that you would use to create a method that would search through an ArrayList of files for a certain file and then delete it, and why?

  Write function in javascript to compute person-s gross pay

Write the function using JavaScript syntax to compute a person's gross pay for a week. The function should receive the number of hours worked and the rate of pay per hour.

  Design a program that asks the user to enter a series of 20

Number Analysis Program: Design a program that asks the user to enter a series of 20 numbers

  Mvc pattern and servlet

When you use the MVC pattern, the controller directs the flow of control to

  Reverse the array, and find the largest element

find the max block of an array by splitting it into three parts: left, middle, right. And then reverse the array, and find the largest element.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd