Assignment #48 BMI Calculator
Code
///Name: Ian Grant
///Period:5
///Project Name: BMI Calculator
///File Name:BMI Calc.java
///11/2/15
import java.util.Scanner;
public class BMICalc
{
public static void main(String[] args)
{
Scanner stuff=new Scanner(System.in);
double m,kg,bmi;
System.out.print("Your height in m: ");
m= stuff.nextDouble();
System.out.print("Your weight in kg: ");
kg= stuff.nextDouble();
bmi=kg/(m*m);
System.out.println("Your BMI is "+bmi);
if (bmi< 15.0)
{
System.out.println("BMI Category: very severely underweight");
}
else if (bmi>=15.0 && bmi<=16.0)
{
System.out.println("BMI Category: severely underweight");
}
else if (bmi>=16.1 && bmi<=18.4)
{
System.out.println("BMI Category: underweight");
}
else if (bmi>=18.5 && bmi<=24.9)
{
System.out.println("BMI Category: normal weight");
}
else if (bmi>=25 && bmi<=29.9)
{
System.out.println("BMI Category: overweight");
}
else if (bmi>=30 && bmi<=34.9)
{
System.out.println("BMI Category: moderately obese");
}
else if (bmi>=18.5 && bmi<=24.9)
{
System.out.println("BMI Category: severly obese");
}
else if (bmi>=18.5 && bmi<=24.9)
{
System.out.println("BMI Category: morbidly obese");
}
}
}
Output