Kat H.

asked • 06/23/21

Write a C++ program that allows a user to choose as many sides for a meal as they want (it’s an ‘all you can eat’ special!).

Assignment 2: Restaurant Choices


Please include source code.


Write a program that allows a user to choose as many sides for a meal as they want (it’s an ‘all you can eat’ special!).


1. Print out a menu and let the user choose a side on the menu. 2. Use a switch statement to print out the side chosen.

3. After printing the side, loop back to let the user enter another side.

4.Make sure that if the user types in a number not on the menu

that the program prints out an error message and loops back to allow the user to re-type the choice.

5.Put a 'quit' in the menu to allow the user to quit choosing sides.


Requirements:


Use a switch statement and a loop statement (for, while or do/while) in your code.


If you need to use a string (not necessary for this exercise), use C strings. No 'string' type allowed.


EXAMPLE OUTPUT #1 --------------------------------

*** Bob's Diner - Sides Menu ***

1 - fries

2 - salad

3 - cole slaw

4 - quit

Enter a choice

2

you chose salad


*** Bob's Diner - Sides Menu ***

1 - fries

2 - salad

3 - cole slaw

4 - quit

Enter a choice

4

Thank you! Your order will be ready soon!


--------------------------------

EXAMPLE OUTPUT #2

--------------------------------

*** Bob's Diner - Sides Menu ***

1 - fries

2 - salad

3 - cole slaw

4 - quit

Enter a choice

1

you chose fries


*** Bob's Diner - Sides Menu ***

1 - fries

2 - salad

3 - cole slaw

4 - quit

Enter a choice

8


you chose cole slaw

*** Bob's Diner - Sides Menu ***

1 - fries

2 - salad

3 - cole slaw

4 - quit

Enter a choice

4


Thank you! Your order will be ready soon!


1 Expert Answer

By:

Patrick B. answered • 06/23/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.