You are on page 1of 1

import java.util.

Scanner;

public class BMICategory_ESTANOCO {


public static void main(String args[]) {
Scanner keyboard = new Scanner(System.in);
double BMI;
double mass, height;
String category;

System.out.println("Enter your mass (kg)");


mass = keyboard.nextDouble();

System.out.println("Enter your height (m)");


height = keyboard.nextDouble();

// Fix this wrong computation for BMI (HINT: Use Math.pow where applicable)
BMI = mass / Math.pow(height, 2);

if (BMI < 16.0) {


category = "Undereweight (Severe Thinness)";

} else if (BMI <= 16.9) {


category = "Undereweight (Moderate Thinness)";

} else if (BMI <= 18.9) {


category = "Undereweight (Mild Thinness)";

} else if (BMI <= 24.9) {


category = "Normal Range";

} else if (BMI <= 29.9) {


category = "Overweight (Pre-obese)";

} else if (BMI <= 34.9) {


category = "Obese (Class I)";

} else if (BMI <= 39.9) {


category = "Obese (Class II)";

} else {
category = "Obese (Class III)";
}

System.out.println("BMI Category is " + category);

}
}

You might also like