Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need solved for C++ Write a program that asks the user for three pieces of data: the name of a food item (a string value),
Need solved for C++
Write a program that asks the user for three pieces of data: the name of a food item (a string value), the number of calories and the number of grams of fat in the item. The program should display the percentage of calories that come from fat. If the calories from fat are less than 33 percent of the total calories of the food, it should display a message indicating that the food is low in fat. If the percentage is equal to or higher than 33 percent, the message should indicate that the food is high in fat. One gram of fat has 10 calories, so calories from fat = fat grams * 10 The percentage of calories from fat can be calculated as Calories from fat / total calories An example of output with the following input values: name of food: hamburger total calories: 1000 Grams of fat: 40 might be: A hamburger with 1000 calories and 40 grams includes 400 fat calories ( 40.0%), making this food high in fat Input validation: The program should make sure that the number of calorios is greater than 0 , the number of fat grams is 0 or more, and the number of calories from fat is not greater than the number of calonies input Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
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