The code snippet below is part of the restaurant menu program you previously used in the lab. Add a  choice for a drink. Add the necessary code to allow the program to calculate the total price of order for  the user. Assume the following price list:  Hamburger $5  Hotdog $4  Fries $3  Drink $2  The program should allow the user to keep entering order until choosing to exit. At the end the program  prints an order summary like this:  You ordered 2 hamburger(s), 1 hotdog(s), 3 fries, 0 drink(s).  Price: $23  HST:  $2.99  Total: $25.99

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

The code snippet below is part of the restaurant menu program you previously used in the lab. Add a  choice for a drink. Add the necessary code to allow the program to calculate the total price of order for  the user. Assume the following price list:  Hamburger $5  Hotdog $4  Fries $3  Drink $2  The program should allow the user to keep entering order until choosing to exit. At the end the program  prints an order summary like this:  You ordered 2 hamburger(s), 1 hotdog(s), 3 fries, 0 drink(s).  Price: $23  HST:  $2.99  Total: $25.99 

do {
printf("What do you want to eat today?\n");
printf("1. Hamburger\n");
printf("2. Hotdog\n");
printf("3. Fries\n");
printf("4. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
switch (choice) {
case 1:
printf("You ordered a hamburger\n");
break;
case 2:
printf("You ordered a hotdog\n");
break;
case 3:
printf("You ordered fries\n");
break;
case 4:
printf("Order finished, thank you!\n");
break;
default:
printf("Wrong choice! try again: ");
}
} while (choice != 4);
Transcribed Image Text:do { printf("What do you want to eat today?\n"); printf("1. Hamburger\n"); printf("2. Hotdog\n"); printf("3. Fries\n"); printf("4. Exit\n"); printf("Enter your choice: "); scanf("%d", &choice); switch (choice) { case 1: printf("You ordered a hamburger\n"); break; case 2: printf("You ordered a hotdog\n"); break; case 3: printf("You ordered fries\n"); break; case 4: printf("Order finished, thank you!\n"); break; default: printf("Wrong choice! try again: "); } } while (choice != 4);
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Program on Numbers
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
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