Assignment #48 and BMICategories
Code
/// Name: Jason Kim
/// Period: 7
/// Program Name: BMICategories
/// File Name: BMICategories.java
/// Date Finished:10/16/15
import java.util.Scanner;
public class BMICategories
{
public static void main (String[] args)
{
Scanner keyboard = new Scanner(System.in);
double m, kg, inch, pound, bmi;
String category;
System.out.print( "Your height in inches: " );
inch = keyboard.nextDouble();
System.out.print("Your weight in pounds: " );
pound = keyboard.nextDouble();
m = 0.0254*inch;
kg = pound*0.45359;
bmi = kg / (m*m);
System.out.println( "\nYour BMI is " + bmi );
if (bmi < 15.0 )
{
category = "very severely underweight";
}
else if (bmi <= 16.0)
{
category = "severely underweight";
}
else if (bmi <= 18.4)
{
category = "underweight";
}
else if (bmi <= 24.9)
{
category = "normal weight";
}
else if (bmi <= 29.9)
{
category = "overweight";
}
else if (bmi <= 34.9)
{
category = "moderately obese";
}
else if (bmi <= 39.9)
{
category = "severely obese";
}
else
{
category = "very severely (or \"morbidly\") obese";
}
System.out.println("BMI Category: " + category);
System.out.println("Note: Although BMI is a very good estimate of human body fat, the formula doesn't work well for atheletes with
a lot of muscle, or people who are extremely shor or very tall. If you are concerned about your BMI, check with your doctor.");
}
}
Picture of the output