Write a C program to create a menu that allows a user to select which takeaway option they require. If the user chooses option "1" that indicates "Toasted cheese and tomato sandwich" If the user chooses option "2" that indicates "Toasted chicken and mayonnaise sandwich" If the user chooses option "3" that indicates "Cheese burger with chips" If the user chooses option "4" that indicates "Medium chips" If the user chooses any other number, the screen must display the following error message: "Incorrect selection. Please choose again" The program must perform the following functionality: i. Display the list of menu items and numbers. ii. Prompt the user to select an item. Use a SWITCH statement to determine the menu item chosen and display the correct choice on the screen. IF YOU DONT USE A SWITCH STATEMENT THE C PROGRAM EILL BE REGARDED AS INCORRECT. If an incorrect item is chosen, display the error message and loop back to re-prompt the user to choose an option again. You have to decide which would be the most appropriate loop construct for the program. Chose among the following loop constructs: 1. For 2. While 3. Do while

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter8: Advanced Data Handling Concepts
Section: Chapter Questions
Problem 1GZ
icon
Related questions
Question

Write a C program to create a menu that allows a user to select which takeaway option they require.

If the user chooses option "1" that indicates "Toasted cheese and tomato sandwich"

If the user chooses option "2" that indicates "Toasted chicken and mayonnaise sandwich"

If the user chooses option "3" that indicates "Cheese burger with chips"

If the user chooses option "4" that indicates "Medium chips"

If the user chooses any other number, the screen must display the following error message: "Incorrect selection. Please choose again"

The program must perform the following functionality:

i. Display the list of menu items and numbers.

ii. Prompt the user to select an item.

Use a SWITCH statement to determine the menu item chosen and display the correct choice on the screen. IF YOU DONT USE A SWITCH STATEMENT THE C PROGRAM EILL BE REGARDED AS INCORRECT.

If an incorrect item is chosen, display the error message and loop back to re-prompt the user to choose an option again.

You have to decide which would be the most appropriate loop construct for the program. Chose among the following loop constructs:

1. For
2. While
3. Do while

Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Random Class and its operations
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
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage