CE – Switch Statement

  1. Modify the sandwich shop program you created in CE – Decision Making to create a menu driven program. Use an integer variable to store the user’s menu choice.
  2. There is a new menu item available. The deli is now selling platters. The price for a platter is $5.50 for 2 or less and $4.75 or 3 or more.
  3. You must test that the value entered for the number of sandwiches, salads or platters is greater than zero. If it is not, display an error message and display the cost of the item as $0.00. The program should NEVER display a negative value for the cost of the item.
  4. The output should look exactly the same as the output for CE – Decision Making
    Provide a case for SANDWICH, PLATTER, SALAD, and QUIT.
    Use the following integer constants to represent these values:
    SANDWICH = 1
    PLATTER = 2
    SALAD = 3
    QUIT = 4
    You must use the constants in your case statements. Do not use hardcoded numbers.
    You will need to add the functionality for quit. If 4 is entered by the user, the program should display a goodbye message.
    You will also need to add a default case for the invalid item error.

This question has been answered.

Get Answer