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 0.
There are 9 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 9.
Tell the user if the item is a low-fat food item. A low-fat food gets 30% 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?
240
How many grams of fat?
5
18.75% of calories from fat. This is a low fat food.
** James Shoe **
How many calories per serving?
-240
Number of calories must more than zero.
How many calories per serving? 240
How many grams of fat?
-5
Number of grams of fat must not be negative and calories
from fat cannot exceed the total calories.
How many grams of fat?
30
Number of grams of fat must not be negative and calories
from fat cannot exceed the total calories.
How many grams of fat?
5
18.75% of calories from fat. This is a low fat food.
The Program Write a program in pseudocode and

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 Programming Questions!