Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started