Question
Accept a pseudocode for following programming exercise-
Fat Gram Calculator
plan a program that asks for the number of fat grams and calories in a food item. Validate the input as follows:
- Make sure number of fat grams and calories are not less than 0.
- According to nutritional formulas, number of calories cannot exceed fat grams X 9. Make sure that number of calories entered is not greater than fat grams x 9.
Once correct data has been entered, the program must calculate and show the percentage of calories that come from fat. Utilize following formula-
Percentage of calories from fat = (fat grams x 9) / calories
some nutritionists classify a food as "low fat" if less than 30 percent of its calories come from fat. If results of these formulas are less than 0.3, the program has to show a message indicating the food is low in fat.