Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Describe the solution to the following problem using the Hierarchy chart and a Java program. We are required to determine how many calories a food
Describe the solution to the following problem using the Hierarchy chart and a Java program. We are required to determine how many calories a food item has per serving due to its fat content. The algorithm accepts the name of food item, the number of grams of fat and the number of servings. Calculate the number of calories in the food item due to fat content, which is computed by multiplying fat grams and calories per gram. Assume the calories per gram are 9. Now, calculate the number of fat calories per serving (use division) and display it. You are required to design the modular program - a module to take inputs, a module to calculate number of calories and a module for calories per serving. Think about using a constant as well. Make the hierarchy chart for the above algorithm to show relationships between modules. For reference, here are the two sample output screen shots. 1. Enter name of food item, fat grams and number of servings: pizza 275 8 Calories in Pizza per serving: 309.37 2. Enter name of food item, fat grams and number of servings: fish 206 3 Calories in Fish per serving: 618.00
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