b Revise the BMI determining program to execute continuously until the user

B revise the bmi determining program to execute

This preview shows page 14 - 19 out of 41 pages.

b. Revise the BMI-determining program to execute continuously until the user enters 0 for the height in inches. :
Programming Logic and Design, 8e Solutions 2-15 Pseudocode: start Declarations num heightInches num weightPounds num heightMeters num weightKilos num bmi num CENT_IN_INCH = 2.54 num CENT_IN_METER = 100 num GRAM_IN_POUND = 453.59 num GRAM_IN_KILO = 1000 string HEIGHT_PROMPT = “Enter the user’s height in inches: ” string WEIGHT_PROMPT = “Enter the user’s weight in pounds: ” string END_LINE = “End of job”
Programming Logic and Design, 8e Solutions 2-16 housekeeping() while heightInches <> 0 detailLoop() endwhile endOfJob() stop housekeeping() output HEIGHT_PROMPT input heightInches return detailLoop() output WEIGHT_PROMPT input weightPounds heightMeters = heightInches * CENT_IN_INCH / CENT_IN_METER weightKilos = weightPounds * GRAM_IN_POUND / GRAM_IN_KILO bmi = weightKilos / (heightMeters * heightMeters) output bmi output HEIGHT_PROMPT input heightInches return endOfJob() output END_LINE return 7.Draw the hierarchy chart and design the logic for a program that calculates service charges for Hazel’s Housecleaning service. The program contains housekeeping,
Programming Logic and Design, 8e Solutions 2-17 Flowchart: Pseudocode: start Declarations string customerLastName num numOfBaths num numOfOtherRooms num serviceCharge num CHARGE_BASE = 40 main program housekeeping() detailLoop() endOfJob()
Programming Logic and Design, 8e

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture