expand icon
book Programming Logic and Design, Introductory 7th Edition by Joyce Farrell cover

Programming Logic and Design, Introductory 7th Edition by Joyce Farrell

النسخة 7الرقم المعياري الدولي: 1285225562
book Programming Logic and Design, Introductory 7th Edition by Joyce Farrell cover

Programming Logic and Design, Introductory 7th Edition by Joyce Farrell

النسخة 7الرقم المعياري الدولي: 1285225562
تمرين 11

a. 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.

الحلول خطوة بخطوة
موثّق
like image
like image

الخطوة 1 من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:

    <div class=answer> 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.

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.


الخطوة 2 من 20


الخطوة 3 من 20


الخطوة 4 من 20


الخطوة 5 من 20


الخطوة 6 من 20


الخطوة 7 من 20


الخطوة 8 من 20


الخطوة 9 من 20


الخطوة 10 من 20


الخطوة 11 من 20


الخطوة 12 من 20


الخطوة 13 من 20


الخطوة 14 من 20


الخطوة 15 من 20


الخطوة 16 من 20


الخطوة 17 من 20


الخطوة 18 من 20


الخطوة 19 من 20


الخطوة 20 من 20

close menu
Programming Logic and Design, Introductory 7th Edition by Joyce Farrell
cross icon