public static void main(String[] args) {
int weight = Integer.parseInt(args[0]);
int hight = Integer.parseInt(args[1]);
//int weight = 120;
//int hight = 160;
double bmi = ((weight*1.0) / (hight*hight)*10000) ;
if(bmi < 18.5 ){
System.out.println("體重過輕");
}
else if(bmi >= 18.5 && bmi < 24 ){
System.out.println("正常範圍");
}
else if(bmi >= 24 && bmi < 27 ){
System.out.println("過 重");
}
else if(bmi >= 27 && bmi < 30 ){
System.out.println("輕度肥胖");
}
else if(bmi >= 30 && bmi < 35 ){
System.out.println("中度肥胖");
}
else{
System.out.println("重度肥胖");
}
}
|