Create an assembly language program that calculates a person’s Body Mass Index (
ID: 665701 • Letter: C
Question
Create an assembly language program that calculates a person’s Body Mass Index (BMI). Use floating-point variables and the floating-point instructions found and described in Chapter 12.
You will need the person’s height in inches and their weight in pounds.
The formula to calculate the Body Mass Index is:
BMI = ( W * 703 ) / ( H * H )
Where: BMI = Body Mass Index
W = weight in pounds
H = height in inches
In addition to correctly calculating the numeric value of the BMI, your program should also display the descriptive word that corresponds to the following range of BMI values:
Range of BMI Values
Description
Less than 18.5
Underweight
18.5 or greater, but less than 25
Normal
25 or greater, but less than 30
Overweight
30 or greater
Obese
Your program should do the following:
1. Prompt the user for their weight in pounds.
2. Prompt the user for their height in inches.
3. Echo the weight and height values back to the User.
3. Calculate and display the BMI value.
4. Display the descriptive word that corresponds to their BMI value.
Range of BMI Values
Description
Less than 18.5
Underweight
18.5 or greater, but less than 25
Normal
25 or greater, but less than 30
Overweight
30 or greater
Obese
Explanation / Answer
'VARIABLES
Dim feet As Double
Dim inches As Double
Dim weight As Double
'Dim health(3) As String
'health(0) = "underweight"
'health(1) = "normal"
'health(2) = "overweight"
'health(3) = "obese"
Private Sub cmdcalculate_Click()
feet = txtfeet.Text
inches = txtinches.Text
weight = txtweight.Text
lblbmi.Caption = (weight * 703) / (((feet * 12) ^ 2) + inches)
bmi = lblbmi.Caption
If (weight * 703) / (((feet * 12) ^ 2) + inches) < 18.5 Then
lblhealth.Caption = underweight
End If
End Sub
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.