Write a java program that models a restaurant ordering system. You will need to have the following methods: public static int displayMenu() This method will display the menu items and price per item. Please keep the same 5 items as I have. You need an option so that the customer can indicate that ordering is done. This method will read the choice from the customer and return that number. public static double getQuantityAndCost(int x) This method will prompt the user for the quantity for the menu choice and then multiply by the appropriate amount. For example, if the user had selected Tacos, then x would be passed in as the value 2 and the return value for this method would be 2 * 4.00. public static double AddTipAmount(double sum) This method will prompt the user for a tip amount. The method receives sum which is the total on the bill after the user has selected Done ordering. For example, the method is called with a sum of 22.00 and the user indicate 10 percent for the tip, the method should return 22.00 + 2.20, or 24.20. The menu will be displayed and get the customer’s item, quantity and cost for will be calculated until the user has selected the Done option. After Done ordering (6) is selected, ask the user for a tip amount. Then finally display the total bill. You will need a main that uses a sentinel controlled while loop to display the menu, get quantity and cost. After the user has selected Done ordering the main will add the tip amount, and finally display the total bill. Sample run below Welcome to Café Grub. Please make your choices and select 6 when you are finished. Menu 1 : Pizza $2.50 2 : Tacos $4.00 3 : Lasagna $5.00 4 : Sushi $3.00 5 : Fish $7.00 6 : Done ordering Please enter your choice: 2 Please enter quantity: 2 Menu 1 : Pizza $2.50 2 : Tacos $4.00 3 : Lasagna $5.00 4 : Sushi $3.00 5 : Fish $7.00 6 : Done ordering Please enter your choice: 5 Please enter quantity: 2 Menu 1 : Pizza $2.50 2 : Tacos $4.00 3 : Lasagna $5.00 4 : Sushi $3.00 5 : Fish $7.00 6 : Done ordering Please enter your choice: 6 Enter tip amount as % i.e. 15: 10 The total bill is $24.20
Write a java program that models a restaurant ordering system. You will need to have the following methods:
public static int displayMenu()
This method will display the menu items and price per item. Please keep the same 5 items as I have. You need an option so that the customer can indicate that ordering is done. This method will read the choice from the customer and return that number.
public static double getQuantityAndCost(int x)
This method will prompt the user for the quantity for the menu choice and then multiply by the appropriate amount. For example, if the user had selected Tacos, then x would be passed in as the value 2 and the return value for this method would be 2 * 4.00.
public static double AddTipAmount(double sum)
This method will prompt the user for a tip amount. The method receives sum which is the total on the bill after the user has selected Done ordering. For example, the method is called with a sum of 22.00 and the user indicate 10 percent for the tip, the method should return 22.00 + 2.20, or 24.20.
The menu will be displayed and get the customer’s item, quantity and cost for will be calculated until the user has selected the Done option.
After Done ordering (6) is selected, ask the user for a tip amount. Then finally display the total bill. You will need a main that uses a sentinel controlled while loop to display the menu, get quantity and cost. After the user has selected Done ordering the main will add the tip amount, and finally display the total bill.
Sample run below
Welcome to Café Grub. Please make your choices and select 6 when you are finished.
Menu
1 : Pizza $2.50
2 : Tacos $4.00
3 : Lasagna $5.00
4 : Sushi $3.00
5 : Fish $7.00
6 : Done ordering
Please enter your choice: 2
Please enter quantity: 2
Menu
1 : Pizza $2.50
2 : Tacos $4.00
3 : Lasagna $5.00
4 : Sushi $3.00
5 : Fish $7.00
6 : Done ordering
Please enter your choice: 5
Please enter quantity: 2
Menu
1 : Pizza $2.50
2 : Tacos $4.00
3 : Lasagna $5.00
4 : Sushi $3.00
5 : Fish $7.00
6 : Done ordering
Please enter your choice: 6
Enter tip amount as % i.e. 15: 10
The total bill is $24.20
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images