Assignment #48
Code
/// Name: Jonathan Stine
/// Period: 5
/// Program Name: BMI Categories
/// File Name: BMICategories.java
/// Date Finished: 1/19/16
import java.util.Scanner;
public class BMICategories {
public static void main( String[] args ) {
Scanner keyboard = new Scanner(System.in);
double m, kg, bmi;
int ft, in, lbs;
System.out.print( "Your height (feet only): " );
ft = keyboard.nextInt();
System.out.print( "Your height (inches): " );
in = keyboard.nextInt();
m = (ft+(in / 12))*0.3048;
System.out.print( "Your weight in lbs: " );
lbs = keyboard.nextInt();
kg = lbs*0.453592;
bmi = kg / (m*m);
System.out.println( "Your BMI is " + bmi );
if ( bmi < 15 ) {
System.out.println( "very severely underweight" );
}
if ( bmi >= 15 && bmi <= 16 ) {
System.out.println( "severely underweight" );
}
if ( bmi > 16 && bmi < 18.5 ) {
System.out.println( "underweight" );
}
if ( bmi >= 18.5 && bmi < 25 ) {
System.out.println( "normal weight" );
}
if ( bmi >= 25 && bmi < 30 ) {
System.out.println( "overweight" );
}
if ( bmi >= 30 && bmi < 35 ) {
System.out.println( "moderately obese" );
}
if ( bmi >= 35 && bmi < 40 ) {
System.out.println( "severely obese" );
}
if ( bmi >= 40 ) {
System.out.println( "morbidly obese" );
}
}
}
Code Output
These stats are Shaq's