Assignment 48
import java.util.Scanner;
public class BMICalc
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
double m, kg, ft, in, lb, bmi;
String category;
category = "";
System.out.print("Your height (feet): ");
ft = keyboard.nextDouble();
System.out.print("Your height (inches): ");
in = keyboard.nextDouble();
System.out.print("Your weight in pounds: ");
lb = keyboard.nextDouble();
m = 0.3048*(ft+in/12);
kg = 0.453592*lb;
bmi = kg / (m*m);
if (bmi < 15)
{
category = "very severely underweight";
}
if (bmi >= 15 && bmi <= 16)
{
category = "severely underweight";
}
if (bmi > 16 && bmi < 18.5)
{
category = "underweight";
}
if (bmi >= 18.5 && bmi < 25)
{
category = "normal weight";
}
if (bmi >=25 && bmi < 30)
{
category = "overweight";
}
if (bmi >= 30 && bmi < 35)
{
category = "moderately obese";
}
if (bmi >=35 && bmi < 40)
{
category = "severely obese";
}
if (bmi > 40)
{
category = "morbidly obese";
}
System.out.println("\nYour BMI is " +bmi+ "\nBMI Category: " +category);
}
}