Assignemnt #48 BMI Categories
Code
///Name: Prooz Fereydouni
///Period: 7
///Project Name: BMI Categories
///File Name: BMIC.java
///Date: 11/3/2015
import java.util.Scanner;
public class BMIC
{
public static void main( String[] args)
{
Scanner keyboard = new Scanner(System.in);
int weight;
double height, BMI;
System.out.print("Your height in m: ");
height = keyboard.nextDouble();
System.out.print("Your weight in kg: ");
weight = keyboard.nextInt();
System.out.println("");
BMI = weight / (height * height);
System.out.print("Your BMI is " + BMI);
if(BMI<15)
{
System.out.println("BMI Category: very severely underweight");
}
if(BMI<=16 && BMI>=15)
{
System.out.println("BMI Category: severely underweight");
}
if(BMI<=18.4 && BMI>=16.1)
{
System.out.println("BMI Category: underweight");
}
if(BMI<=24.9 && BMI>=18.5)
{
System.out.println("BMI Category: normal weight");
}
if(BMI<=29.9 && BMI>=25)
{
System.out.println("BMI Category: overweight");
}
if(BMI<=34.9 && BMI>=30)
{
System.out.println("BMI Category: moderately obese");
}
if(BMI<=39.9 && BMI>=35)
{
System.out.println("BMI Category: severely obese");
}
if(BMI>40)
{
System.out.println("BMI Category: very severely (or \"morbidly\") obese");
}
}
}
Picture of the output