Question

The Body Mass Index (BMI) is a calculation used to categorize whether a person’s weight is...

The Body Mass Index (BMI) is a calculation used to categorize whether a person’s weight is at a healthy weight for a given height. The formula is as follows:

                bmi = kilograms / (meters2)

                where kilograms = person’s weight in kilograms, meters = person’s height in meters

BMI is then categorized as follows:

Classification

BMI Range

Underweight

Less than 18.5

Normal

18.5 or more, but less than 25.0

Overweight

25.0 or more, but less than 30.0

Obese

30.0 or more

To convert inches to meters:

                meters = inches / 39.37

To convert pounds (lbs) to kilograms:

                kilograms = lbs / 2.2046

Assignment

Ask the user for their weight in pounds and height in inches. Compute their BMI and BMI classification and output the results.

The program must implement and use the following methods:

convertToKilograms – convert pounds to kilograms

convertToMeters – convert inches to meters

calcBMI – take weight in kilograms and height in meters and return the BMI

bmiClassification – take the value for the BMI and return a String with the BMI classification

Use the following code as a starting point for your assignment:

import java.util.Scanner;

// TODO Student name, date, purpose
public class Main {

    private static Scanner input = new Scanner(System.in);

    public static void main(String[] args) {
        double lbs, inches, meters, kgs, bmi;
        String classification;

       // TODO add code here
   
}

   // TODO add your methods here (make them static)
}

As always use the package name edu.cscc and include a comment with your name, the date, and the purpose of the program.

Example Output

Calculate BMI

Enter weight (lbs): 200

Enter height (inches): 72

Your BMI is 27.124767811523153

Your BMI classification is Overweight

Homework Answers

Answer #1
import java.util.Scanner;
public class BMI {
    private static Scanner input = new Scanner(System.in);

    public static void main(String[] args) {
        System.out.println("Calculate BMI");
        System.out.print("Enter weight (lbs): ");
        double weight = input.nextDouble();
        System.out.print("Enter height (inches): ");
        double height = input.nextDouble();

        double bodyMass = bmi(height, weight);

        report(bodyMass);
    }

    public static double bmi(double height, double weight) {
        return (weight * 703 / height / height);
    }

    public static void report(double bmi) {
        System.out.printf("Your BMI is %f\n",bmi);
        System.out.print("Your BMI classification is ");
        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");
        }
    }
}
Know the answer?
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
Similar Questions
Write a modular program that calculates and displays a person’s body mass index (BMI). The BMI...
Write a modular program that calculates and displays a person’s body mass index (BMI). The BMI is often used to determine whether a person is overweight or underweight for his or her height. A person’s BMI is calculated with the following formula BMI = weight * 703/height2 Where weight is measured in pounds and height is measured in inches. The program should ask the user to enter his or her weight and height and then display the user’s BMI. The...
Your body mass index (BMI) is your weight in kilograms divided by the square of your...
Your body mass index (BMI) is your weight in kilograms divided by the square of your height in meters. High BMI is a common but controversial indicator of overweight or obesity. A study by the National Center for Health Statistics found that the BMI of American young men (ages 20-29) is approximately Normal with mean 25.8 and standard deviation 4.2. To have a BMI higher than 90% of all men aged 20-29, what would your BMI would need to be?
The body mass index (BMI) of a person is the person’s weight divided by the square...
The body mass index (BMI) of a person is the person’s weight divided by the square of his or her height. It is an indirect measure of the person’s body fat and an indicator of obesity. Results from surveys conducted by the Centers for Disease Control and Prevention (CDC) showed that the estimated mean BMI for US adults increased from 25.0 in the 1960–1962 period to 28.1 in the 1999–2002 period. [Source: Ogden, C., et al. (2004). Mean body weight,...
BMI (Body Mass Index) is your weight in kilograms divided by the square of your height...
BMI (Body Mass Index) is your weight in kilograms divided by the square of your height in meters. BMI for women is approximately Normal with mean 26.8 and standard deviation 7.4; If you wanted to classify the bottom 15% of all women as underweight and top 15% of all women as “obese” what BMI indices would you need to separate these two categories?
The following are body mass index (BMI) scores measured in 9 patients who are free of...
The following are body mass index (BMI) scores measured in 9 patients who are free of diabetes and participating in a study of risk factors for obesity. Body mass index is measured as the ratio of weight in kilograms to height in meters squared. 25 27 31 33 26 28 38 41 24 What is the standard deviation of BMI? You MUST show your work to receive full credit.
A common characterization of obese individuals is that their body mass index is at least 30...
A common characterization of obese individuals is that their body mass index is at least 30 [BMI = weight/(height)2, where height is in meters and weight is in kilograms]. An article reported that in a sample of female workers, 265 had BMIs of less than 25, 159 had BMIs that were at least 25 but less than 30, and 122 had BMIs exceeding 30. Is there compelling evidence for concluding that more than 20% of the individuals in the sampled...
1.Investigators studied the relationship between screen time (measured in hours/week) and body-mass-index, BMI=wt/ht^2 (wt=weight in kg...
1.Investigators studied the relationship between screen time (measured in hours/week) and body-mass-index, BMI=wt/ht^2 (wt=weight in kg and ht=height in meters), in men age 25 -45 . They surveyed 6234 U.S. men in this age group, the scatter diagram for the data was homoscedastic and the BMI data was approximately normally distributed both unconditionally and in each vertical strip. The investigators generated the following summary statistics: X=35 SDX=12 Y=27 SDY=6 r=0.8 where X=hours of screen-time per week, and Y=BMI. (a) (2...
Objective: The student will apply course objectives through evaluating patient assessments, identifying treatment options and developing...
Objective: The student will apply course objectives through evaluating patient assessments, identifying treatment options and developing teaching plans for patients with obesity, peptic ulcer disease (PUD) and gastroesophageal reflux disease (GERD). Part I: Obesity & Bariatric Surgery A 32-year-old obese patient has come to the bariatric outpatient center to have an initial evaluation. The patient reports that they were always overweight, even as a child. The patient states that they are frustrated because they gained 100 pounds over the last...