Assignemnt #48: BMICategories
Code
/// Name: Kelsey Lieberman
/// Period 5
/// Program Name: BMICategories
/// File Name: BMICategories.java
/// Date Finished: 11/6/2015
import java.util.Scanner;
public class BMICategories
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
double m, kg, bmi, wt_lb, height, ht_in, ht_ft;
System.out.print("Your height (feet only): ");
ht_ft = keyboard.nextDouble();
System.out.print("Your height (inches): ");
ht_in = keyboard.nextDouble();
System.out.print("Your weight in pounds: ");
wt_lb = keyboard.nextDouble();
height = ((ht_ft * 12) + ht_in);
kg = (wt_lb * 0.453592);
m = (height * 0.0254);
bmi = kg/(m*m);
System.out.println("\nYour BMI is: " + bmi );
System.out.print("BMI Category: ");
if (bmi < 15.0)
{
System.out.println("Very severely underweight");
}
if (bmi <= 15.0 && bmi >= 16.0)
{
System.out.println("Severely underweight");
}
if (bmi > 16.0 && bmi < 18.5)
{
System.out.println("Underweight");
}
if (bmi >= 18.5 && bmi < 25.0)
{
System.out.println("Normal weight");
}
if (bmi >= 25.0 && bmi < 30.0)
{
System.out.println("Overweight");
}
if (bmi >= 30.0 && bmi < 35.0)
{
System.out.println("Moderately obese");
}
if (bmi >= 35.0 && bmi < 40.0)
{
System.out.println("Severely Obese");
}
if (bmi >= 40.0)
{
System.out.println("Very severely obese");
}
System.out.println();
}
}
Picture of the output