Assignment #48 BMI Categories
Code
/// Name: Koosha Kimelman
/// Period: 7
/// Program Name: BMI Categories
/// File Name: BMICategories.java
/// Date Completed: 10/20/15
import java.util.Scanner;
public class BMICategories {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
double height, weight, BMI;
System.out.print("Your height in m: ");
height = keyboard.nextDouble();
System.out.print("Your weight in kg: ");
weight = keyboard.nextDouble();
System.out.println();
BMI = weight / (height*height);
System.out.println("Your BMI is " + BMI);
if (BMI < 15.0) {
System.out.println("BMI Category: very severely underweight");
}
else if (BMI >= 15.0 && BMI <= 16.0) {
System.out.println("BMI Category: severely underweight");
}
else if (BMI >= 16.1 && BMI <= 18.4) {
System.out.println("BMI Category: underweight");
}
else if (BMI >= 18.5 && BMI <= 24.9) {
System.out.println("BMI Category: normal weight");
}
else if (BMI >= 25.0 && BMI <= 29.9) {
System.out.println("BMI Category: overweight");
}
else if (BMI >= 30.0 && BMI <= 34.9) {
System.out.println("BMI Category: moderately obese");
}
else if (BMI >= 35.0 && BMI <= 39.9) {
System.out.println("BMI Category: severely obese");
}
else if (BMI >= 40.0) {
System.out.println("BMI Category: morbidly obese");
}
else {
System.out.println("Input correct values please");
}
}
}
Picture of the output