Draw the hierarchy chart and then plan the logic for a program that calculates a
ID: 3667751 • Letter: D
Question
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. Revise the BMl-determining program to execute continuously until the user enters 0 for the height in inches.Explanation / Answer
In the first Module Build a class BMIDemo with instance variable height which is in inches know build a method to convert inches to meter
heightInMeters = heightInInches * 2.54 *100
In the Second Module Build a method to convert a pound into kilograms
WeightInKilograms = WeightInpounds * 453.53 *1000
In the last Module display the BMI by taking height in inches Or meters and weight in pound Or Kilogram
BMI(pounds/inches2) = (weightInPound / (heightInInches * heightInInches)) * 703
Or
BMI(Kg/m2) = (weightInKilogram/ (heightInMeters * heightInMeters)) * 703
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.