Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class BMICategories
- {
- public static void main( String[] args )
- {
- Scanner one = new Scanner(System.in);
- double height, weight, BMI;
- String BMICat = "";
- System.out.print( "Your height in m: ");
- height = one.nextDouble();
- System.out.print( "Your weight in kg: ");
- weight = one.nextDouble();
- System.out.println( "\nYour BMI is " + (weight/(height*height)) + " ");
- BMI = one.nextDouble();
- System.out.println("BMI Category: " + BMICat + " ");
- if (BMI < 18.5)
- BMICat = "underweight";
- if (BMI >= 18.5 && BMI < 24.9)
- BMICat = "normal weight";
- if (BMI >= 25.0 && BMI < 29.9)
- BMICat = "overweight";
- if (BMI > 30.0)
- BMICat = "obese";
- // else
- // BMICat = "morbidly obese";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement