Question: C++ File Edit Format View Help //Description: this program will caculate the number of calories // in a meal based on user input //***** //##

C++  C++ File Edit Format View Help //Description: this program will caculate
the number of calories // in a meal based on user input

File Edit Format View Help //Description: this program will caculate the number of calories // in a meal based on user input //***** //## ******This is the line of 80 characters in length**** ######Your code should not exceed the length of the above line########## #include using namespace std; int main() { char meal_choice; //user's choice int servings, total_calories; // Display greeting: cout > meal_choice; cout > servings; // TODO: Use a switch statement to evaluate the user's meal choice // Handle error checking where appropriate // Exit the program: return 0; The amount of calories in each serving are as follows: Pizza - 500 calories Salad - 150 calories Hamburger - 450 calories Use a switch statement to evaluate the user's meal choice. The user can input the following values: P - Pizza S - Salad H - Hamburger Make sure you handle error checking li.e. invalid meal choice, invalid serving amount) Terminate the program if there is bad input Provide an error message explaining why there is a problem Do not use more than one return statement in your program. Sample Run 1: Welcome to the Calorie Count-ulator! Enter your meal choice (Plizza, [S]alad, [H]amburger): P Enter the amount of servings (1-9): 2 Total calories consumed: 1000 Sample Run 2: Welcome to the Calorie Count-ulator! Enter your meal choice (Plizza, [S]alad. (H]amburger): H Enter the amount of servings (1-9): 0 ERROR: Invalid serving amount. Terminating the program. Sample Run 3: Welcome to the Calorie Count-ulator! Enter your meal choice ([P]izza, [S]alad, [H]amburger): Q ERROR: Invalid meal choice. Terminating the program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!