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
  • 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...

  • 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.

  • 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...

  • javafx 1. Implement a BMI (Body Mass Index) server that will accept height and weight from...

    javafx 1. Implement a BMI (Body Mass Index) server that will accept height and weight from the client, calculate the BMI and return a string with the BMI and a status (l.e. normal, over weight, etc.). Build a GUI using JavaFX. You are given a working BMI class that will do the BMI calculations, etc. A single BMI client connection is sufficient. 2. Implement a JavaFX BMI client that will allow the user to enter height (in inches), weight (in...

  • The body mass index (BMI) is a measure of relative weight based on height and weight....

    The body mass index (BMI) is a measure of relative weight based on height and weight. The body fat percentage (BFP) of a human or other living being is the total mass of fat divided by total body mass, multiplied by 100; body fat includes essential body fat and storage body fat. Essential body fat is necessary to maintain life and reproductive functions. Write a program that calculates and prints the BFP for multiple persons; the program allows user to...

  • Using C++ cs 102 REVIEW LAB Selection a) Minimum/Maximum: Nrite a program that asks the user...

    Using C++ cs 102 REVIEW LAB Selection a) Minimum/Maximum: Nrite a program that asks the user to enter two numbers. The progzan should use the conditional operator to determine which number is the smaller and which is the larger. Display your output in the format below: The smaller number is: (smallerNumber) The larger number is: ClargerNumber] b) Areas of Rectangles: The area of a rectangle is calculated by maltiplying its length tines its width. Write a program that asks the...

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
ADVERTISEMENT