Assignment #48 and BMI Categories
Code
/// Name: Lauren Baird
/// Period: 7
/// Program Name: BMI Categories
/// File Name: BMICategories.java
/// Date Finished: 10/22/2015
import java.util.Scanner;
public class BMICategories
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String result = "";
double m, kg, bmi, inches, pounds;
System.out.print( "Your height in inches: " );
inches = keyboard.nextDouble();
m = inches * 0.0254;
System.out.print( "Your weight in pounds: " );
pounds = keyboard.nextDouble();
kg = pounds * 0.453592;
bmi = kg / (m*m);
System.out.println();
System.out.println( "Your BMI is " + bmi );
if ( bmi < 15.0 )
{
result = "very severely underweight";
}
if ( bmi >= 15.0 && bmi <= 16.0 )
{
result = "severely underweight";
}
if ( bmi >= 16.1 && bmi <= 18.4 )
{
result = "underweight";
}
if ( bmi >= 18.5 && bmi <= 24.9 )
{
result = "normal weight";
}
if ( bmi >= 25.0 && bmi <= 29.9 )
{
result = "overweight";
}
if ( bmi >= 30.0 && bmi <= 34.9 )
{
result = "moderately obese";
}
if ( bmi >= 35.0 && bmi <= 39.9 )
{
result = "severely obese";
}
if ( bmi >= 40.0 )
{
result = "very severely (or \"morbidly\" obese)";
}
System.out.println( "BMI Category: " + result );
}
}