Assignment #48 and BMI Categories
Code
/// Name: Ali Kurland
/// Period: 6
/// Program Name: BMI Categories
/// File Name: BMICategories.java
/// Date Finished: 10/2/2015
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();
BMI = ( weight / ( height * height ) );
System.out.println( "Your BMI is " + BMI );
System.out.print("BMI Category: " );
if ( BMI < 15.0 )
{
System.out.println( "very severely underweight" );
}
if ( (BMI >= 15.0) && (BMI <= 16.0) )
{
System.out.println( "severely underweight" );
}
if ( (BMI >= 16.1) && (BMI <= 18.4 ) )
{
System.out.println( "underweight" );
}
if ( (BMI >= 18.5) && (BMI <= 24.9) )
{
System.out.println( "normal weight" );
}
if ( (BMI >= 25.0) && (BMI <= 29.9) )
{
System.out.println( "overweight" );
}
if ( (BMI >= 30.0) && (BMI <= 34.9) )
{
System.out.println( "moderately obese" );
}
if ( (BMI >= 35.0) && (BMI <= 39.9) )
{
System.out.println( "severely obese" );
}
if ( BMI >= 40.0 )
{
System.out.println( "very severely obese" );
}
}
}
Picture of the output