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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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 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).
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Structure chart
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education