Assignemnt #48 and BMI Categories
Code
/// Name: Brian Phillips
/// Period: 5
/// Program name: BMICategories
/// File Name: BMICategories.java
/// Date Finished: 11/30/2015
import java.util.Scanner;
public class BMICategories
{
public static void main( String[] args)
{
Scanner keyboard = new Scanner(System.in);
double in, lbs, bmi, kg, m;
System.out.print( "Your height in inches: " );
in = keyboard.nextDouble();
System.out.print( "Your weight in lbs: " );
lbs = keyboard.nextDouble();
kg = lbs*(0.45359237);
m = in / (39.3701);
bmi = (kg) / (m*m);
System.out.println ( "Your BMI is " + bmi );
if (bmi < 15.0)
{
System.out.println ( "BMI Category: Very severly underweight" );
}
if ( bmi > 14.9999999 && bmi < 16.1 )
{
System.out.println ( "BMI Category: severly underweight" );
}
if ( bmi > 16.0 && bmi < 18.49999999 )
{
System.out.println ( "BMI Category: underweight" );
}
if ( bmi > 18.499999999999 && bmi < 18.5 )
{
System.out.println ( "BMI Category: normal weight" );
}
if ( bmi > 24.99999999999 && bmi < 29.999 )
{
System.out.println ( "BMI Category: overweight" );
}
if ( bmi > 29.99999999 && bmi < 34.999 )
{
System.out.println ( "BMI Category: moderately obese" );
}
if ( bmi > 34.999999999 && bmi < 39.9999 )
{
System.out.println ( "BMI Category: severely obese" );
}
if ( bmi > 39.9999999999 )
{
System.out.println ( "very severly (or \"morbidly\") obese" );
}
}
}
Picture of the output