Advertisement
stanziak

Untitled

Apr 15th, 2016
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class BMICategories
  3. {
  4. public static void main( String[] args )
  5. {
  6. Scanner one = new Scanner(System.in);
  7. double height, weight, BMI;
  8. String BMICat = "";
  9.  
  10. System.out.print( "Your height in m: ");
  11. height = one.nextDouble();
  12. System.out.print( "Your weight in kg: ");
  13. weight = one.nextDouble();
  14. System.out.println( "\nYour BMI is " + (weight/(height*height)) + " ");
  15. BMI = one.nextDouble();
  16. System.out.println("BMI Category: " + BMICat + " ");
  17. if (BMI < 18.5)
  18. BMICat = "underweight";
  19. if (BMI >= 18.5 && BMI < 24.9)
  20. BMICat = "normal weight";
  21. if (BMI >= 25.0 && BMI < 29.9)
  22. BMICat = "overweight";
  23. if (BMI > 30.0)
  24. BMICat = "obese";
  25. // else
  26. // BMICat = "morbidly obese";
  27.  
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement