Write a C++ program to calculate food ordering charge. We assume that each customer only orders one type of food. For example, if a customer chooses hamburger (e.g., enter 1 by using keyboard to indicate choose hamburger), then he/she will not choose other types of food. Each customer can order multiple items. For example, if a customer chooses to order hamburger, then he/she will enter how many hamburgers he/she want to order (e.g. enter 3 by using keyboard to order 3 hamburgers). The program should display a menu first and then ask customer to choose a type of food from the menu and then ask customer how many foods to order. After that, the program will calculate the total charge: total charge ($) = unit price of selected type of food * ordering quantity of the food + sales tax amount ($), and then the program will generate outputs to display food type, unit price, ordering quantity, sales tax, and total charge in console. More detailed requires are as follows: Design your own food menu. Note the menu should contain at least four different types o
Write a C++
The program should display a menu first and then ask customer to choose a type of food from the menu and then ask customer how many foods to order. After that, the program will calculate the total charge: total charge ($) = unit price of selected type of food * ordering quantity of the food + sales tax amount ($), and then the program will generate outputs to display food type, unit price, ordering quantity, sales tax, and total charge in console. More detailed requires are as follows:
- Design your own food menu. Note the menu should contain at least four different types of foods, each with a different unit price, and students are not allowed to use the following sample menu in their lab3.1 program.
- The program will ask customer to make their choice (e.g., customer enters a number 1, 2, 3, or 4). If customer enters a choice (e.g., 10) that is not on the menu, the program should display a message says: “Invalid input, try again later.” and then exit the entire program by using exit () function.
- Based on the customer’s choice (i.e., selected one type of food on the menu, to determine the unit price (as listed in the menu) by using switch-case
- Compute the total price (i.e. unit price times the amount) for this order.
- The city needs to charge 5% of sales tax on each order, compute the total charge that is the summation of the total price and sales tax.
- Print out the details of customer order including food type, unit price, ordering quantity, sales tax, and total charge in console. Sample outputs for ordering two chicken burgers:
- Compile, run, and test your program to make sure there are no syntax and logical errors in the program. Generate a testing report document to show program inputs and outputs for at least three testing cases (must include a case when user enters an invalid number).
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images