if else计算BMI


import java.util.Scanner;

public class ComeputeBMI {
public static void main(String[] args){
    Scanner input=new Scanner(System.in);
    System.out.println("please enter your weight in pound");
    double weight=input.nextDouble();
    System.out.println("please enter your hight in inch");
    double hight=input.nextDouble();


    double weightInKilograms=weight*0.45359237;
    double hightInMeters=hight*0.0254;


    double bmi=weightInKilograms/(hightInMeters*hightInMeters);

    System.out.println("BMI IS "+bmi);

    if(bmi<18.5)
    System.out.println("偏瘦");

    else if(bmi<25.0)
    System.out.println("正常");

    else if (bmi<30.0)
    System.out.println("偏胖");


    else
System.out.println("肥胖");


}

}

你可能感兴趣的:(if else计算BMI)