Write a program that accepts a single character representing a Food Item in the menu as input from the user. Then the program should print
Write a program that accepts a single character representing a Food Item in the menu as input from the user. Then the program should print out the text for the appropriate Food Item.
- Your program prompts the user with "Enter the first letter of the Food Item:"
- Your program asks the user to input a character, which can have any value.
- Your program prints output according to the following:
- If the input is 'B', print "Burger"
- If the input is 'P', print "Pizza"
- If the input is 'F', print "Fries"
- If the input is 'S', print "Sandwiches"
- Any input value that is not 'B', 'P', 'F','S' print "Invalid"
Note: You must use a switch case for this problem. if/else statements are not allowed.
The format of the output should be "You Ordered: "
Example output (User Input in bold):
Enter the first letter of the Food Item: S You Ordered: Sandwiches
Enter the first letter of the Food Item: F You Ordered: Fries
Enter the first letter of the Food Item: B You Ordered: Burger
Enter the first letter of the Food Item: P You Ordered: Pizza
Enter the first letter of the Food Item: D You Ordered: Invalid
Please add the main() function only in the answer box
- Language C++ / using CodeRunner
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started