Question: Your solution ( identification headers ) must include the following: Flowchart Pseudo - code Program coded Program outpuT Problem Statement Design a program that asks
Your solution identification headers must include the following:
Flowchart
Pseudocode
Program coded
Program outpuT
Problem Statement
Design a program that asks for the number of fat grams and calories in a food item to determine the percentage of calories from fat. Validate input as follows:
The number of fat grams must be at least
The number of calories must be at least
The number of calories cannot be less than fat grams
After input has been validated, use the following formula to determine the percentage of calories from fat:
Percentage of calories from fat fat grams calories.
Your program should consist of the following:
Module main. Calls getFat, getCalories, and showPercent.
Function getFat. Accepts user input of fat grams. Validate user input as a nonnegative number and return valid fat grams.
Function getCalories. Accepts user input of total calories. Validate user input as a number that is nonnegative and greater than or equal to fat grams Return a valid number of calories.
Module showPercent. Displays percent of fat in the food item, determined by this formula: fat grams calories. Displays a message indicating the food item is "low fat" if the percentage of fat is less than
Expected Output
Your output should be similar to the following:
Please enter the number of fat grams:
Please enter the number of calories:
The number of calories cannot be less than the number of fat grams
Please enter the number of calories.
The percentage of calories from fat is percent.
Please enter the number of fat grams:
The number of fat grams cannot be less than
Please enter the number of fat grams.
Please enter the number of calories.
The percentage of calories from fat is
That food item is considered "low fat".
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
