Question

Visual Basic: The federal government developed the body mass index (BMI) to determine ideal weights. Body...

Visual Basic:

The federal government developed the body mass index (BMI) to determine ideal weights. Body mass index is calculated as 703 times the weight in pounds, divided by the square of the height in inches, and then round to the nearest whole number. Define a function that accepts a person’s weight and height as inputs and returns the person’s health status (A BMI of 19 to 25 corresponds to a healthy status).

0 0
Add a comment Improve this question Transcribed image text
Answer #1
Visual Basic Code (Console Application)

Module Module1

Sub Main()

Dim weight As Double
Dim height As Double

'** Inputting weight from user
Console.Write("Enter weight in pounds: ")
weight = Double.Parse(Console.ReadLine())

'** Inputting height from user
Console.Write("Enter height in inches: ")
height = Double.Parse(Console.ReadLine())

'** Printing result
Console.WriteLine(vbCrLf + "Your health status is: " + getHealthStatus(weight, height))
Console.ReadKey()

End Sub

'''


''' Function to calculate the BMI based on weight and height entered and decides the health status based on calculated BMI
'''

'''
'''
'''
''' Returns Health status of the user
'''

Function getHealthStatus(ByVal weight As Double, ByVal height As Double) As String

'*** Calculating the BMI
Dim BMI As Int16 = Math.Round(703 * weight / Math.Pow(height, 2))

Dim status As String = ""

'*** Deciding the health status based on BMI
If BMI < 19 Then
status = "Under Weight"
ElseIf BMI >= 19 And BMI <= 25 Then
status = "Healthy"
ElseIf BMI > 25 And BMI <= 30 Then
status = "Over Weight"
ElseIf BMI > 30 Then
status = "Obese"
End If

Return status
End Function

End Module

OUTPUT

file:///C:/Users/User/Documents/Visual Studio 2010/Projects/BMI Enter weight in pounds: 116.845 Enter height in inches: 64.76

Add a comment
Know the answer?
Add Answer to:
Visual Basic: The federal government developed the body mass index (BMI) to determine ideal weights. Body...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Program 1 BMI Calculator Write a Java program to calculate the Body Mass Index (BMI) BMI...

    Program 1 BMI Calculator Write a Java program to calculate the Body Mass Index (BMI) BMI can be calculated as follow BMI = (weight in pounds X 703) / (Height in inches X Height in inches)

  • The body mass index (BMI estimates the amount of fat in a person's body. It is defined as the person's mass m in kilograms divided by the square of the person's height h in meters. Write...

    The body mass index (BMI estimates the amount of fat in a person's body. It is defined as the person's mass m in kilograms divided by the square of the person's height h in meters. Write the formula for BMI in terms of m and h. 0 BMI In the United States, most people measure weight in pounds and height in feet and inches. When weight W is measured in pounds and height h is measured in inches, the BMI...

  • Write a program to calculate the Body Mass Index (BMI). The formulae to calculate the BMI...

    Write a program to calculate the Body Mass Index (BMI). The formulae to calculate the BMI are BMI = (weightinPounds x 703) / (heightinInches x heightinInches ) or BMI = weightinKilograms / (heightinMeters x heightinMeters ) Your program should read the user's weight in pounds and height in inches (or, Kilograms and meters, if you prefer), calculate and display the BMI. Your program should also display a message indicating how the BMI is evaluated, based on the following BMI values:...

  • Using JAVAFX The application will calculate Body Mass Index (BMI) for people. It must be able...

    Using JAVAFX The application will calculate Body Mass Index (BMI) for people. It must be able to accept as input weights (in pounds or kilos), and height (in inches or centimeters). The application should have a calculate button, and should display the result as well as if the data puts the person in one of 4 categories underweight ( BMI < 18.5) , normal weight (BMI 18.5-24.9), overweight (BMI 25.0 - 29.9) or overweight (BMI > 30) For full credit...

  • Weight: 131 lbs Female Height: 5 ft 2 inches Calculate, showing the math, your Body Mass...

    Weight: 131 lbs Female Height: 5 ft 2 inches Calculate, showing the math, your Body Mass Index (BMI) using the formula 'weight in kilograms divided by height in meters squared' (kg/m^2). Note: Weight in pounds divided by 2.2 = weight in kg and height in inches times .0254 = height in meters. The number is absolute and not a percentage. Based on your BMI, are you underweight, healthy weight, overweight, or obese?

  • 1. Your Body Mass Index (BMI) is a measure of your weight relative to your height....

    1. Your Body Mass Index (BMI) is a measure of your weight relative to your height. The formula can be found here: http://www.whathealth.com/bmi/formula.html (use the Imperial U.S. Method). Write an algorithm in pseudocode to calculate and display a person's BMI accepting as input their height in feet and inches and their weight in pounds. The output of your algorithm should be as follows: a. BMI b. A statement of whether the result is underweight, normal, overweight or obese.

  • The table shows results for the Body Mass Index (BMI) of random samples of men and...

    The table shows results for the Body Mass Index (BMI) of random samples of men and women. The BMI is the weight (kg) divided by the square of the height (m). Male BMI Female BMI n = 40 _ x =28.4 s = 7.39 n = 40 _ x = 26.6 s = 5.34 At the 5% LOS, do the data suggest the men have greater variability in BMI compared to women?

  • OGICAL 28. Body mass index (BMI) is a measure of obesity. In standard units, it is...

    OGICAL 28. Body mass index (BMI) is a measure of obesity. In standard units, it is calculated by the formula EMENTS BMI = 7032 ATEMENT NESTED INTS where Wis weight in pounds, and His height in inches. The obesity classification is BMI Classification Below 18.5 Underweight 18.5 to 24.9 Normal 25 to 29.9 Overweight 30 and above Obese Tue Write a program in a script file that calculates the BMI of a person. The program asks the person to enter...

  • In Java Body mass index is a measure of whether someone's weight is appropriate for their...

    In Java Body mass index is a measure of whether someone's weight is appropriate for their height. A body- mass-index value between 19 and 25 is considered to be in the normal range. Here's the formula for calculating body mass index: BMI- (704 x weight in pounds) / height in inches*2 a) Implement a program that prompts the user for height and weight values and displays the associated body mass index. Perform input validation by making sure that the user...

  • c++ pls 10D yUur Tugt Sna you will have to re-take it at another time PROBLEM...

    c++ pls 10D yUur Tugt Sna you will have to re-take it at another time PROBLEM 1 Body Mass Index (BMI) is a measure of body fat that is useful in screening for health issues. To calculate a BMi, you need the height in inches and the weight in pounds. You square the height, then divide the weight in pounds by the squared-height. BMI is defined in terms of meters and kilograms, so to convert from pounds and inches to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT