Question

In: Computer Science

Create a BMI calculator that reads the user’s weight and height (providing an option for the...

Create a BMI calculator that reads the user’s weight and height (providing an option for the user to select which formula to use), and then calculates and displays the user’s body mass index. Also, display the BMI categories and their values from the National Heart Lung and Blood Institute: http://www.nhlbi.nih.gov/health/educational/lose_wt/BMI/bmicalc.htm (Links to an external site.) so the user can evaluate his/her BMI.

Java Version

Solutions

Expert Solution

import java.util.*;

public class BMICalc {
    public static void main(String[] args) {
        Scanner console = new Scanner(System.in);
        System.out.print("height (in feet)? ");
        double feet = console.nextInt();
        System.out.print("height (in inches)? ");
        double height = console.nextDouble();
        height = feet*12 + height;
        System.out.print("weight (in pounds)? ");
        double weight = console.nextDouble();
        double bmi = (weight * 703 / height / height);
        System.out.printf("BMI = %.1f\n",bmi);
        if (bmi < 18.5) {
            System.out.println("underweight");
        } else if (bmi < 25) {
            System.out.println("normal");
        } else if (bmi < 30) {
            System.out.println("overweight");
        } else {
            System.out.println("obese");
        }
    }
}


Related Solutions

USING MATLAB: Create a BMI calculator application that reads the user’s weight in pounds and height...
USING MATLAB: Create a BMI calculator application that reads the user’s weight in pounds and height in inches (or, if you prefer, the user’s weight in kilograms and height in meters), then calculates and displays the user’s body mass index. Also, the application should display the following information from the Department of Health and Human Services/National Institutes of Health so the user can evaluate his/her BMI: BMI VALUES ("Underweight : Less than 18.5 Normal : between 18.5 and 24.9 Overweight...
Java - Write a program to calculate a user’s BMI and display his/her weight status. The...
Java - Write a program to calculate a user’s BMI and display his/her weight status. The status is defined as Underweight, Normal, Overweight and obese if BMI is less than 18.5, 25, 30 or otherwise respectively. You need to read weight (in kilogram) and height (in metre) from the user as inputs. The BMI is defined as the ratio of the weight and the square of the height. [10 marks]
calculate the BMi. weight 138lb, height 5ft and 5 inches
calculate the BMi. weight 138lb, height 5ft and 5 inches
What is the BMI for a person his weight is 173 pounds and his height is...
What is the BMI for a person his weight is 173 pounds and his height is 5 feet and 7 inches. Make sure to write all the mathematics steps
The Body Mass Index (BMI) is a value calculated based on the weight and the height...
The Body Mass Index (BMI) is a value calculated based on the weight and the height of an individual. In a small European city, a survey was conducted one year ago to review the BMI of the citizens. In the sample 22 with 200 citizens, the mean BMI was 23.3 kg/m and standard deviation was 1.5 kg/m . It is reasonable to assume the BMI distribution is a normal distribution. (a) Find the point estimate of the population mean BMI...
The Body Mass Index (BMI) is a value calculated based on the weight and the height...
The Body Mass Index (BMI) is a value calculated based on the weight and the height of an individual. In a small European city, a survey was conducted one year ago to review the BMI of the citizens. In the sample with 200 citizens, the mean BMI was 23.3 kg/m2 and standard deviation was 1.5 kg/m2 . It is reasonable to assume the BMI distribution is a normal distribution. (a) Find the point estimate of the population mean BMI one...
Assess Mr. Glenn Birch height and weight. Calculate his BMI and % usual body weight. What...
Assess Mr. Glenn Birch height and weight. Calculate his BMI and % usual body weight. What would be a reasonable weight goal for Mr. Glenn Birch? Give your rationale for the method you used to determine the goals. This is a middle-aged male, who presented recently to the Bariatric Center for evaluation and treatment of longstanding morbid obesity and associated comorbidities. He underwent standard bariatric evaluation, consults, diagnostics, and preoperative Medifast induced weight loss in anticipation of elective bariatric surgery....
JAVA The class will have a constructor BMI(String name, double height, double weight). The class should...
JAVA The class will have a constructor BMI(String name, double height, double weight). The class should have a public instance method, getBMI() that returns a double reflecting the person's BMI (Body Mass Index = weight (kg) / height2 (m2) ). The class should have a public toString() method that returns a String like Fred is 1.9m tall and is 87.0Kg and has a BMI of 24.099722991689752Kg/m^2 (just print the doubles without special formatting). Implement this class (if you wish you...
Physiological class. In measurement. How and why might the Weight/height ratio be more valuable than BMI?
Physiological class. In measurement. How and why might the Weight/height ratio be more valuable than BMI?
Java Language Only Use Java FX In this project we will build a BMI calculator. BMI...
Java Language Only Use Java FX In this project we will build a BMI calculator. BMI is calculated using the following formulas: Measurement Units Formula and Calculation Kilograms and meters (or centimetres) Formula: weight (kg) / [height (m)]2 The formula for BMI is weight in kilograms divided by height in meters squared. If height has been measured in centimetres, divide by 100 to convert this to meters. Pounds and inches Formula: 703 x weight (lbs) / [height (in)]2 When using...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT