This is solved assignment of programming logic course. If you are looking for assistance in programming logic, you can contact us at email@example.com
Programming Logic and Design Assignment
A man named John Raymond is so pleased with the program you created for his clients that he refers you to his coworker, a nutritionist in the same fitness facility. The nutritionist would like you to create a program that calculates fat grams and calories.
Design a program that asks for the number of fat grams and calories in a food item. Validate the input as follows:
- Make sure the number of fat grams and calories is not less than 0.
- According to nutritional formulas, the number of calories cannot exceed fat grams× 9. Make sure that the number of calories entered is not greater than fat grams × 9.
Once correct data has been entered, the program should calculate and display the percentage of calories that come from fat. Use the following formula:
Percentage of calories from fat=(Fat grams×9)÷Calories
Some nutritionists classify a food as “low fat” if less than 30 percent of its calories come from fat. If the results of this formula are less than 0.3, the program should display a message indicating the food is low in fat.
- Create the pseudo-code for this program
- Create a flowchart for this program
Module main() Declare String doAnother Do Call getFatcalories() Display "Do you have another item? (Enter y for yes.)" Input doAnother While doAnother == "y" OR doAnother == "Y" End Module Module getFatcalories() Declare Real fatgram, calories,fatcalories Display "Enter number of fat grams." Input fatgram While fatgram < 0 Display "Number of fat grams cannot be negative. Please" Display "enter the correct number of fat grams." Input fatgram End While Display "Enter calories" Input calories While calories < 0 Display "The calories cannot be negative. Please" Display "enter the correct calories." Input calories End While While calories > fatgram*9 Display "The calories cannot be more than 9 times fatgrams. Please" Display "enter the correct calories." Input calories End While Set fatcalories = (fatgram*9) / calories Display "The percentage of calories that come from fat is $", fatcalories While fatcalories<30% Display "This is low fat food" End While End Module
We, at Xamnation, are helping students in their assignment and project work for IT courses. Students can get online tutoring, personal mentorship and project help from us. Learn how to create pseudocode, flowchart and write computer programs. Email us your assignment to firstname.lastname@example.org and we will gladly help you.