-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBodyMassIndex-(BMI) interpretations
36 lines (29 loc) · 1.15 KB
/
BodyMassIndex-(BMI) interpretations
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
//Body Mass Index Computations
Scanner input = new Scanner(System.in);
//Imput Weight in pounds
System.out.print("Enter your weight (pound) : ");
double weight = input.nextDouble();
//Input height in inches
System.out.print("Enter your height (Inches) : ");
double height = input.nextDouble();
// conversion of pounds to kilograms
double weightInKilograms = weight * 0.453592d;
// comversion of inches to meters
double heightInMeters = height * 0.0254d;
// BMI formula
double bmi = weightInKilograms / (heightInMeters * heightInMeters);
System.out.println("You Body Mass Index is: "+bmi);
// BMI Interpretations
if (bmi < 18.5d)
System.out.println("-> Underweight");
else if (bmi >= 18.5 && bmi< 25.0d)
System.out.println("-> Normal");
else if (bmi >= 25.0 && bmi < 30.0)
System.out.println("-> Overweight");
else if (bmi >= 30d)
System.out.println("-> Obese");
}
}