Question: The Program Write a program in pseudocode and python to calculate the percentage of fat calories in a food item. Your program should allow the
The Program
Write a program in pseudocode and python to calculate the percentage of fat calories in a food
item. Your program should allow the total number of calories in the food item and the
number of grams of fat. Validate the input as follows:
Make sure the number of calories and the number of fat grams are not less than
There are calories in every gram of fat. The calories from fat must not exceed the total calories in the food item. Make sure that the number of
calories entered is not greater than fat grams times
Tell the user if the item is a lowfat food item. A lowfat food gets or less of its calories from fat.
Round the percentage of calories from fat to two digits to the right of the decimal point.
Screenshot
Here's an example of what you program should look like:
James Shoe
How many calories per serving?
How many grams of fat?
of calories from fat. This is a low fat food.
James Shoe
How many calories per serving?
Number of calories must more than zero.
How many calories per serving?
How many grams of fat?
Number of grams of fat must not be negative and calories
from fat cannot exceed the total calories.
How many grams of fat?
Number of grams of fat must not be negative and calories
from fat cannot exceed the total calories.
How many grams of fat?
of calories from fat. This is a low fat food.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
