• To analyse, a problem in an object-oriented manner, and then design and implement an object-oriented solution;
  • To practise using dynamic data structures in Java, from the Java API;
  • To practise file input and output in Java.

Submission Details

You must submit all the required files as mentioned below. Java files should be able to run and executed by simple commands javac filename.java and run by java filename. No other coding files are allowed. That means coding done in eclipse are not compiled due to path problems. Coding will be run at Linux command prompt.

Please Note:

(1)Throughout this assignment you are expected to use dynamic data structures such as linked lists as there should be no limits on the number of hotel rooms, guests, menu items and orders the system can hold. You are allowed, and encouraged, to use the Java API Collection classes, such as LinkedList or Vector and so on. You may use one, or more, of these classes.

Problem Description

Many hotels offer room service to their guests. That is, food or drink, ordered by the guest, cooked and delivered to their room. This involves quite a bit of information processing and your assignment is to implement two tasks related to this service as described below.

NOTE: Throughout this document there are several file names mentioned. You are required to write these files yourself, based on the format, specifications and examples in this document.

When a hotel guest calls for room service, an order taker takes down their order and enters it into the system. There are 3 main steps in the ordering process: greeting the customer, taking the order, and order finalisation including a delivery estimate.

Step 1: Greeting the customer

When the order taker receives the phone call, they check the callers phone number and enter this into the order taking system. The system will display to them the current occupant of the room so that the order taker can greet the guest by name.

An interaction with the order taking system would start as follows (user entry is shown in bold throughout this assignment):

Room Service Ordering Facility:
Enter phone number: 2393


Room: 344
Floor: 3

Room type: Standard Twin Num adults: 1

Num children: 0 Name: Ms Jane Doe
Enter an order? [Y/N]: y

The system must provide all the details shown above. These details can be found in data files. The text file rooms.dat contains information about the rooms in the hotel. Each room in the hotel is described in one line each with four, semicolon-separated, parts. The room number comes first, followed by the phone number (extension), then the floor of the room, and then the room type. For example:

344; 2393;3;Standard Twin
211;1111; 2;Superior Single
1922;1919;12; Junior Suite

The text file occupancy.dat contains information about the guests staying in the hotel and which room they are occupying. Like rooms.dat, each entry in occupancy.dat takes 1 line each. Each entry is comma separated, and consists of the room number, the name of the occupant, the title of the occupant, the number of adults in the room, and the number of children in the room. For example:

211,Fred Nerk,Mr,2,0
344,Jane Doe, Ms,1,0
1200 ,Tweedle van Spock,Dr,1,2

There is only one thing that the order taker can choose to do for a customer and that is to take down an order. They enter y or Y at the final question to choose this option. (Note: all menu options in this assignment must be case insensitive.) If they do not want to enter an order for this guest (maybe someone called room service by mistake), then they can enter any other character and the process starts over.

Terminating the program: The order taker can terminate the program by entering the fictitious phone number of -999.

Step 2: Taking the order

After choosing to enter an order, the entering of the actual order commences by displaying an ordering menu which will be repeatedly displayed until E is entered.

Ordering phase
O: Order a menu item
C: Add comment to order as a whole A: Adjust cost of order
S: Show order summary
R: Remove item from order E: End ordering phase

Step 2a: Ordering an item

Selecting O from the ordering menu, takes the order taker to the Menu menu. In the Menu menu, the items available from room service are listed, and the order taker can select one, or filter the menu to reduce the options. The Menu menu could look as follows:

1: Spaghetti bolognaise
2: Char kway teow
3: Tuna salad
4: Toasted sandwich
5: Spring vegetable risotto
6: Chicken schnitzel
41: Chocolate mousse
42: Fruit salad
43: Fried mars bars
44: Trifle
45: Sundae
51: Apple cider
52: Chocolate milkshake
53: Iced tea
54: Orange juice
Enter a menu item’s number to order it
'F' to filter the menu,
'V' to view the characteristics of an item 'R' to redisplay the entire menu:
Enter selection:

The items in the room service menu will be stored in a file and could change (you must not hardcode them within your program!). The menu items must be shown neatly and sorted by menu item number. The text file menu.dat contains information about the menu items that are available. Each record is represented on one line and consists of the menu number, a colon, the name of the dish, a colon, the price, a colon and then a full stop separated list of properties of the dish. The list of properties allows the order taker to advise the guest on which dishes suit certain dietary requirements. (V = Vegetarian, E = Vegan, N = Nut free, G = Gluten free, L = Lactose free, K = Kosher, H = Halal). If the letter is preceded by a C, it means that the dish can be modified to conform to that requirement. For example, the tuna salad can be made vegetarian by leaving out the tuna.

1:Spaghetti bolognaise:15.99:H.L
51:Apple cider:3.20:V.G.E.H
45:Sundae :8:V.K.H .CN
3:Tuna salad:13.90:CV.G.CK

If the order taker enters an F option then the Menu menu is redisplayed with only the items conforming to the required dietary restriction. For example, if the order taker enters FV the menu is redisplayed with only the menu items that had the attribute V in their list of dietary requirements. If the order taker enters FCG then the menu is redisplayed with all the items that are gluten free or can be adapted to be gluten free.

If the order taker enters a V option then more details are displayed about the menu item they chose. For example, if they entered V45, the details about sundaes would be displayed.

Item: Sundae
Price: $8.00

Vegetarian, Kosher, Halal, can be made Nut free.
Press enter to continue.

After viewing these details then the order taker presses enter and the menu is displayed again (make sure that if the menu had been filtered the filtered version is viewed).

If the order taker enters R then filters are removed and the entire menu is redisplayed.

If the order taker simply enters a number, then if the number refers to an existing menu item number, the ordering of that item occurs.

For example if the order taker entered 45 then the following would occur:

Selected item: Sundae
Add comment: Strawberry and caramel, no nuts
Enter price [$8.00]:

If the order taker enters text after the add comment prompt, it must be stored, if they simply hit enter, then no comment is added. If they want to adjust the price they can enter it after the enter price comment. If they simply hit enter then the cost is the default cost.

After ordering an item, the order taker is returned to the ordering menu.

Step 2b: Adding a comment to the order

At the ordering menu, the order taker can add a comment to the whole order. Each time this item is chosen it overwrites the previous comment associated with the order. For example:

Existing comment: [Wants 3 forks]
New comment: Wants 3 forks, and 12 red roses in vase

Step 2c: Adjusting the total price of the order

Sometimes guests requests have a cost associated with them. For example in the previous example, supplying red roses comes at extra cost. This can be added to the order by using option A

Existing order adjustment: $0.00
Adjust cost of order by: +25.50
New order adjustment: $25.50

Step 2d: Showing a summary of the order

To review the items entered so far the order taker enters S to get a summary. A sample summary is as follows:

$ 13.90 Tuna salad
$ 8.00 Sundae [Strawberry and caramel, no nuts]
$ 21.90 Subtotal
$ 25.50 Order Adjustment [Extra services/deductions]
$ 47.40 Total
Additional comments:
[Wants 3 forks, and 12 red roses in vase]

Step 2e: Removing an item from the order

To remove an item from the order, the items are displayed numbered, and the order taker can select an item by number to remove. For example:

Remove an item:
1. $ 13.90 Tuna salad
2. $ 8.00 Sundae [Strawberry and caramel, no nuts]
Enter item number to remove: 2

If the order taker hits enter without a number, control is returned to the main menu, if the order taker enters a number which does not exist, the program must re-prompt the order taker for a valid number.

Step 3: Finalisation and Delivery Estimate

After entering E at the ordering menu, the process enters the final phase. A summary of the order is displayed to the order taker, along with an estimate of the delivery time. The delivery time estimate is calculated as: 20 mins plus 3 mins for each item in orders that are already waiting to be cooked. For example if there are 3 previous orders and 2 items in each previous order the waiting time is 20+6*3 or 38 minutes. This allows the order taker to summarise the order to the guest, and then choose to confirm or cancel the order. For example

$ 13.90 Tuna salad
$ 8.00 Sundae [Strawberry and caramel, no nuts]
$ 21.90 Subtotal
$ 25.50 Order Adjustment [Extra services/deductions]
$ 47.40 Total
Additional comments:
[Wants 3 forks, and 12 red roses in vase]
Estimated delivery time: 38 minutes Place order [Y/N]: y

If the order taker chooses any letter but Y then the order is cancelled and control returns to the initial prompt for phone number. If the order taker chooses y then the order is written to a text file numbered by the room number (followed by a hyphen and a sequence number) and the orders are redisplayed. For example if the order 1 is selected above, a receipt would be written as follows to the file 344-1

Room: 344
Floor: 3
Name: Ms Jane Doe $ 13.90 Tuna salad
$ 8.00 Sundae [Strawberry and caramel, no nuts]
$ 21.90 Subtotal
$ 25.50 Order Adjustment [Extra services/deductions]
$ 47.40 Total

A subsequent order from the same room would have a receipt stored in file 344-2.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.