Assignemnt #48: BMI Categories
Code
/// Name: Cassie
/// Period: 6
/// Program Name: BMI Categories
/// File Name: BMICategories.java
/// Date Finished: 11/19/2015
import java.util.Scanner;
public class BMICategories {
public static void main( String[] args ) {
double BMI;
Scanner keyboard = new Scanner(System.in);
double m, kg, lbs, in, ft, bmi;
System.out.print( "Your height (feet): " );
ft = keyboard.nextDouble();
System.out.print( "Your height (inches): " );
in = keyboard.nextDouble();
System.out.print( "Your weight in pounds: " );
lbs = keyboard.nextDouble();
kg = (lbs * 0.453592);
m = (in * 0.0254) + (ft * 0.3048);
BMI = kg / (m*m);
System.out.println( "Your BMI is " + BMI );
if ( BMI < 15.0 )
{
System.out.println( "BMI Category: Very severely underweight" );
}
if ( BMI > 15.0 && BMI <= 16.0 )
{
System.out.println( "BMI Category: Severely underweight" );
}
if ( BMI > 16.1 && BMI <= 18.4 )
{
System.out.println( "BMI Category: Underweight" );
}
if ( BMI > 18.5 && BMI <= 24.9 )
{
System.out.println( "BMI Category: Normal weight" );
}
if ( BMI > 25.0 && BMI <= 29.9 )
{
System.out.println( "BMI Category: Overweight" );
}
if ( BMI > 30.0 && BMI <= 34.9 )
{
System.out.println( "BMI Category: Moderately obese" );
}
if ( BMI > 35.0 && BMI <= 39.9 )
{
System.out.println( "BMI Category: Severely obese" );
}
if ( BMI > 40.0 )
{
System.out.println( "BMI Category: Morbidly obese" );
}
}
}
Picture of the output