Assignemnt #48 and BMI Categories
Code
///Name: Daniel Tiffany-Appleton
///Period: 7
///Program Name: BMI Categories
///File Name: BMICategories
///Date Finished: 10/27/15
import java.util.Scanner;
public class BMICategories
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
double m, kg, bmi, inches, inchesTogether, pounds, feet, feetInInches;
System.out.print( "Your height (feet only): " );
feet = keyboard.nextDouble();
feetInInches = feet*12;
System.out.print( "Your height (inches): " );
inches = keyboard.nextDouble();
inchesTogether = inches + feetInInches;
m = inchesTogether*0.0254;
System.out.print( "Your weight in pounds: " );
pounds = keyboard.nextDouble();
kg = pounds*0.453592;
bmi = kg / (m*m);
System.out.println( "Your BMI is " + bmi );
if ( bmi < 15.0 )
{
System.out.println( "BMI Category: very severely underweight" );
}
if ( 15.0 <= bmi && bmi <= 16.0 )
{
System.out.println( "BMI Category: severely underweight" );
}
if ( 16.1 <= bmi && bmi <= 18.4 )
{
System.out.println( "BMI Category: underweight" );
}
if ( 18.5 <= bmi && bmi <= 24.9 )
{
System.out.println( "BMI Category: normal weight" );
}
if ( 25.0 <= bmi && bmi <= 29.9 )
{
System.out.println( "BMI Category: overweight" );
}
if ( 30.0 <= bmi && bmi <= 34.9 )
{
System.out.println( "BMI Category: moderately obese" );
}
if ( 35.0 <= bmi && bmi <= 39.9 )
{
System.out.println( "BMI Category: severely obese" );
}
if ( 40.0 <= bmi )
{
System.out.println( "BMI Category: very severely obese" );
}
}
}
Picture of the output