Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class BMICalc
- {
- public static void main(String[] args)
- {
- double convertW, convertI, convertF, HbyH, height, bmi;
- double f2m = 3.28;
- double p2kg = 0.45;
- double in2mt = 0.0254;
- Scanner Keyboard = new Scanner(System.in);
- System.out.print("Your height in feet only: ");
- int feet = Keyboard.nextInt();
- System.out.print("\nYour height in inches: ");
- int inches = Keyboard.nextInt();
- System.out.print("\nYour weight in pounds: ");
- int weight = Keyboard.nextInt();
- convertW = (weight*p2kg);
- convertF = (feet/f2m);
- convertI = (inches*in2mt);
- height = (convertF + convertI);
- HbyH = (height*height);
- bmi = (convertW/HbyH);
- System.out.println("\nYour BMI is " + bmi);
- if ( bmi <= 18.5)
- {
- System.out.println("\nBMI Category: underweight ");
- }
- else if ( bmi > 18.5 && bmi < 24.9)
- {
- System.out.println("\nBMI Category: normal weight ");
- }
- else if ( bmi >25.0 && bmi <29.9)
- {
- System.out.println("\nBMI Category: overweight ");
- }
- else if ( bmi >= 30.0)
- {
- System.out.println("\nBMI Category: obese ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment