import java.util.Scanner;
/*编写程序,根据输入的性别,身高,体重,计算体重指数BMI
BMI 是国际上常用的衡量人体胖瘦程度以及是否健康的一个标准,算法:kg/m2
标准:男性低于20, 女性低于19,属于过轻;男性20-25,女性19-24,属于适中;
男性25-30,女性24-29,属于过重;男性30-35,女性29-34,属于肥胖;男性高于35,女性高于34,属于非常肥胖。专家指出最理想的体重指数是22。*/
public class Bmi {
public static void main(String[] args) {
float height,weight, BMI;
System.out.print("请输入性别,身高/米,体重/kg");
Scanner yx= new Scanner(System.in);
char sex=yx.next().charAt(0);
height=yx.nextFloat();
weight=yx.nextFloat();
BMI=weight/(height*height);
if(sex=='男'){
if(BMI<20){
System.out.println("过轻");}
if(20<BMI&&BMI<25){
System.out.println("适中");}
if(25<BMI&&BMI<30){
System.out.println("过重");}
if(30<BMI&&BMI<35){
System.out.println("肥胖");
}
if(BMI>35){
System.out.println("非常肥胖");
}
}
if(sex=='女'){
if(BMI<19){
System.out.println("过轻");}
if(19<BMI&&BMI<24){
System.out.println("适中");}
if(24<BMI&&BMI<29){
System.out.println("过重");}
if(29<BMI&&BMI<34){
System.out.println("肥胖");
}
if(BMI>34){
System.out.println("非常肥胖");
}
}
}}