BMICalculator.java BMI计算器
//EBU4201(2021/22) lab1- question3- BMICalculator.java
public class BMICalculator {
public static void main(String[] args){
double Weight = Double.parseDouble(args[0]);
double height = Double.parseDouble(args[1]);
double Height = height/100;
double BMI = Weight/(Height*Height);
System.out.printf("Your weight : %.0f Kg\n" ,Weight);
System.out.printf("your height : %.2f m\n" ,Height);
System.out.printf("Your BMI : %.2f\n " ,BMI);
System.out.print("You are in the ");
if (BMI < 18.5)
System.out.println("Underweight range .");
else if (BMI >= 18.5 && BMI <= 24.9)
System.out.println("Normal range .");
else if (BMI >= 25 && BMI <= 29.9)
System.out.println("Overweight range .");
else if (BMI >= 30)
System.out.println("Obese range .");
else
System.out.println("INPUT ERROR !!");
}
}