
Programming Logic and Design, Introductory 7th Edition by Joyce Farrell
Edition 7ISBN: 1285225562
Programming Logic and Design, Introductory 7th Edition by Joyce Farrell
Edition 7ISBN: 1285225562a. Draw the hierarchy chart and then plan the logic for a program that calculates a person’s body mass index (BMI). BMI is a statistical measure that compares a person’s weight and height. The program uses three modules. The first prompts a user for and accepts the user’s height in inches. The second module accepts the user’s weight in pounds and converts the user’s height to meters and weight to kilograms. Then, it calculates BMI as weight in kilograms divided by height in meters squared, and displays the results. There are 2.54 centimeters in an inch, 100 centimeters in a meter, 453.59 grams in a pound, and 1,000 grams in a kilogram. Use named constants whenever you think they are appropriate. The last module displays the message End of job.
b. Revise the BMI-determining program to execute continuously until the user enters 0 for the height in inches.
Step 1 of 20
a.
Hierarchy chart:
The Hierarchy chart explains only the how many modules are exist in this program and which modules call others.
The hierarchy chart for the person’s body mass index calculation program is shown below:
In the above hierarchy chart,
• The main program calls the three modules such as “userDetails()”, “calculateBMI()”, and “endOfJob()”.
o The userDetails() module gets the user height in inches.
o The calculateBMI() module gets the user weight in pounds, convert the height and weight, and finally calculate and display the user’s body mass index.
o The endOfJob() module end the process.
Step 2 of 20
Step 3 of 20
Step 4 of 20
Step 5 of 20
Step 6 of 20
Step 7 of 20
Step 8 of 20
Step 9 of 20
Step 10 of 20
Step 11 of 20
Step 12 of 20
Step 13 of 20
Step 14 of 20
Step 15 of 20
Step 16 of 20
Step 17 of 20
Step 18 of 20
Step 19 of 20
Step 20 of 20
Why don’t you like this exercise?
Other