Assignemnt #48 and BMI Categories
Code
/// Name: Raff Lisbona
/// Period: 6
/// Program Name: BMI Categories
/// File Name: BMICategories.java
/// Date Finished: 11/2/2015
import java.util.Scanner;
public class BMICategories
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
double kg, m, bmi, in, lb;
String category;
category = "";
System.out.print( "Your height in inches: " );
in = keyboard.nextDouble();
System.out.print( "Your weight in pounds: " );
lb = keyboard.nextDouble();
m = in * 0.0254;
kg = lb * 0.453592;
bmi = kg / (m*m);
System.out.println( "Your BMI is " + bmi );
if ( bmi < 18.4 )
{
category = "underweight";
}
if ( bmi > 18.5 && bmi < 24.9 )
{
category = "normal weight";
}
if ( bmi > 25 && bmi < 29.9 )
{
category = "overweight";
}
if ( bmi > 30 )
{
category = "obese";
}
System.out.println("BMI Category: " + category );
}
}
Picture of the output