Question: IN JAVA CODING You operate a restaurant and have a menu of items to offer your customer. A program is needed to take online orders
IN JAVA CODING You operate a restaurant and have a menu of items to offer your customer. A program is needed to take online orders for your food orders. You offer four entrees and two different side items. A customer first orders the total number of each entre that they want, and then they can choose side items.
Entrees Price
Salmon $18.00
Chicken $12.25
Steak $19.89
Lamb $15.59
Sides Price
Fries $ 2.99
Salad $ 4.99
The program that is needed for the online ordering system will allow the customer to order as many of each entree as they wish. They are then asked how many of each side they wish. It should ask for each side item at a time. When completing an order, an itemized bill is to be displayed. This bill should include a 7% sales tax and 10.0% service fee that applies to the subtotal, before taxes.
The Order Class (Order.java):
Instance variables: integer variables to store the counts for each of the menu items. Include double constant variables for the cost of each entre and each side. Also, include double constants for the tax rate and service charge rate. This class has the following methods:
Methods:
- Getters and setters for all instance variables.
- Constructor - the constructor should pass the counts for each of the menu items collected
- calculateSubTotal(): This method should calculate what the cost of the entrees are. It should return the subtotal.
- calculateTax(): This method should calculate tax given the subtotal.
- calculateServiceCharge(): This method should return service charge given the subtotal.
- calculateTotalCharge(): This method should receive the subtotal, tax and service charge and return the final total.
- toString(): See the summary below in the sample run to define the output
The Driver Class (Restaurant.java):
The driver class takes care of the following:
Input:
Your program will start by asking the user how many of each entre item they want. It will then proceed to ask the user to choose how many of each side item they want. Once all the items have been selected, instantiate an object and pass in these values.
Output:
Print the title, a line with each food item and the number of each item purchased, a subtotal of the cost of the items ordered, tax, delivery charge, and the total using the toString method.
Sample Run
Welcome to the online order system.
Choose the number of each entree you wish to order.
How many Salmon orders do you want: 1
How many Chicken orders do you want: 2
How many Steak orders do you want: 0
How many Lamb orders do you want: 1
Choose the number of each side you wish to order.
How many Fries orders do you want: 0
How many Salad orders do you want: 2
You have ordered the following:
Salmon 1
Chicken 2
Steak 0
Lamb 1
Fries 0
Salad 2
Subtotal: $68.07
Tax: $4.76
Service Fee: $6.81
Total: $79.64
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
