Question: Java programming: Topics Rounding, If-Else, Switch statement, While loop Problem: Your restaurant business has been getting a lot of attention lately and the customers requested
Java programming: Topics Rounding, If-Else, Switch statement, While loop
Problem: Your restaurant business has been getting a lot of attention lately and the customers requested you to start an online delivery system. Write an application that presents the customer with a menu of the restaurant, let them choose the dishes from the menu, and show them the total price of the order. Procedure
1. Present the user with the menu containing various dishes and their prices
2. Ask the user to enter the number of different dishes they like to order
3. For each dish, ask how many servings of that dish they would like to order
4. Calculate the tax
5. Ask if they want to leave a tip and calculate the tip if they say yes
6. Show the user the breakdown of the prices and the total price for their order
Sample Output:
Mr.Ks Indian Food Menu
Item Price (in dollars)
1 Chicken Curry 10.69
2 Shrimp Curry 14.25
3 Naan 3.59
4 Chai 2.45
5 Sindhi Biryani 7.24
6 Lamb Biryani 15.59
7 Veg Biryani 11.27
8 Gobi Manchurian 10.35
9 Chana Masala 9.45
10 Kheer 4.99
How many different dishes would you like to order today? 3
Enter dish 1 [1-10] 1
How many servings of dish 1
would you like to order? 1
Enter dish 2 [1-10] 10
How many servings of dish 10
would you like to order? 2
Enter dish 3 [1-10] 5
How many servings of dish 5
would you like to order? 1
Enter the tax %: 5.5
Do you want to add tip? [y - yes or n - no] y
Enter tip % [0-100]: 10
Price: 27.91
Tax (5.5%): 1.54
Tip (10.0%): 2.95
Total Amount: $32.4
Your order has been placed and will be delivered soon!
Requirements:
There should be a minimum of 10 dishes
You should use at least one while loop
You should use at least one if statement
You should use at least one switch statement
The double values (price, tax, tip, and total amount) should be rounded to two decimal digits depending on whether the 3rd decimal digit is less than or equal to 5.
Few examples: 4.456 = 4.46, 5.784 = 5.78, 4.5648 = 4.56. You should not use any rounding functions.
Menu and prices are left up to your discretion but the rest of the output should look exactly the same as shown in the sample output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
