Code
/// Name: Afaf Nabeeha
/// Period: 7
/// Program Name: BMI Categories
/// File Name: BMI.java
/// Date Finished: 11/18/2015 public class BMI
import java.util.Scanner;
public class BMI
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
double M, Kg, BMI;
String category;
category = "a";
System.out.print( "Your height in M: " );
M = keyboard.nextDouble();
System.out.print( "Your weight in Kg: " );
Kg = keyboard.nextDouble();
System.out.println();
BMI = Kg / (M*M);
System.out.println( "Your BMI is " + BMI );
if ( BMI < 18.5 )
{
category = "underweight";
}
if (( BMI >= 18.5 ) && ( BMI <= 24.9 ))
{
category = "normal weight";
}
if (( BMI >= 25.0 ) && ( BMI <= 29.9 ))
{
category = "over weight";
}
if ( BMI >= 30.0 )
{
category = "obese";
}
System.out.println( "BMI Category: " + category );
}
}
Picture of the output