Question: Question 2 : ( 1 5 pts ) ( based on our textbook exercises 5 on page 2 3 9 ) ( Must follow the

Question 2: (15 pts)(based on our textbook exercises 5 on page 239)(Must follow the
instructions below to get full grade)
The body mass index (BMI) is calculated as a person's weight (in pounds) times 720,
divided by the square of the person's height (in inches). A BMI in the range of 19-25,
inclusive, is considered healthy. Write a program that calculates a person's BMI and
prints a personalized/funny message telling whether they are above, within, or below
the healthy range.
You need to write THREE functions for this program:
First function, you can name height_change_to_inches(h_f, h_i), which will take
height in BOTH feet AND inches as two formal parameters (e.g.: if the person is 6 feet and 2
inches tall we will invoke this function as height_change_to_inches(6,2)), then RETURN
(no need to print out) the height in inches only (we did a similar assignment before). So for
example, if we call height_change_to_inches (6,2), it would return 74.
Second function, you can name calculate_BMI(h, w), which will take two parameter
values (height and weight) to calculate the BMI, then RETURN (no need to print out) this newly
calculated value of BMI.
Last function, we normally name it main(), which will call/use/invoke TWO functions we
created from previous steps:
It will ask for user to input their height (in feet and inches) and weight (in pounds).
height returned from height_change_to_inches () with the user's inputs (feet and
inches), and weight from the user's input will be passed to function calculate_BMI () as
actual parameters. The returned BMI value will be used to make if/elif/else multi-way
decision (a BMI in the range 19-25, inclusive, is considered healthy). See an outline of the
program below:
Proj4_Q2_YourLastName.py
def height_change_to_inches (2 formal paramenter(s)):
you will add more code here to return a new value of height
in inches
def calculate_BMI(2 formal paramenter(s)):
you will add more code here to return a new value of BMI
```
def main():
# get user's inputs of height as feet AND inch and pass them as
actual parameters to height_change_to_inches() function
# call height_change_to_inches (2 actual parameters) function
here, to return a new value of height in inches only. Assign this
value to some new variable.*
# get user's input of weight and pass it as one of the two actual
parameters to calculate_BMI() function
# call calculate_BMI(2 actual parameters from steps above)
function, to return a new value of BMI. "Capture" it in some
variable.*
#use if/elif/else multi-way decision to print out if someone with a certain height
and weight is below, within, or above the BMI range of 19-25. Make this message funny
in your own way.
main() #calling main() will start executing the program
```
Question 2 : ( 1 5 pts ) ( based on our textbook

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!