Write a program in c++ that asks for the number of calories


Write a program in C++ that asks for the number of calories and fat grams in a food. The program should display the percentage of calories that come from the fat. If the calories from fat are less than 30% of the total calories of the food, it should also display a message indicating the food is low in fat.

One gram of fat has 9 calories, so... Calories from fat = fat grams * 9
The percentage of calories from fat can be calculated as... Calories from fat / total calories

Input validation: Make sure the # of calories is greater than 0 and the number of fat grams is 0 or more. Also, the number of calories from fat cannot be greater than the total number of calories. If that happens, display an error message indicating that either the calories or fat grams were incorrectly entered.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Write a program in c++ that asks for the number of calories
Reference No:- TGS0129383

Expected delivery within 24 Hours