PLEASE HELP!!! I'm short on time, or else i'd work on it myself

Write a program that displays the following menu:

Select your menu:

1. Lunch Special, $10.59

2. Burgers and Fries, $13.50

3. Gumbo, $10.00

4. Salad, $9.99

The instructions: your program must use switch instead of if statement. Display the menu shown above.

Menu selection one should display the message, "You chose Lunch Special, "

Menu selection two should display the message, "You chose Burgers and Fries"

Menu selection three should display the message, "You chose Gumbo"

Menu selection one should display the message, "You chose Salad, "

You chose Gumbo

Your Total: $10.80 (use 8% sales tax to calculate the total, in the example, Gumbo cost $10 + $.8 tax)
http://www.cplusplus.com/doc/tutorial/control/
First ask the user to input the menu number from the listed menu,then put that number in a switch statement that prints for different numbers different output.
https://www.geeksforgeeks.org/switch-statement-cc/
Try to write a problem on you own and put your code what you have done and if you have mistakes somebody would certainly help you,but I do not believe anyone is going to do other people homeworks and that kind of stuff.
some quick direction on an easy design
struct amenu
{
string words;
double price;
};
amenu menu[5];
menu[1].words = "Lunch Special";
menu[1].price = 10.59;
… //add all the items.
menu[0].words = "Invalid Choice";
…//
cin >> choice.
switch(choice)
case 1: case 2: case 3: case 4:
cout << "you chose " << menu[choice].words << endl;
cout << "your price " << menu[choice].price * 1.08 << endl;
break;
default: cout << menu[0].words << endl;

also, this best thing you can learn from this is that programming takes time. Do not let yourself get short on time again. You can swap the struct and array of struct for just 2 arrays that are correlated by index if you want, its less code but not a great design (works here but falls apart for bigger programs).
Last edited on
Topic archived. No new replies allowed.