import java.util.Scanner;
public class Exp2_4{
public static void main(String args[]){
char[] erqi={'M','F'};
System.out.print("您的性别是(M/F):");
Scanner reader=new Scanner(System.in);
char er=reader.next().charAt(0);
System.out.print("请输入你的身高:");
Scanner reader1=new Scanner(System.in);
float qi=reader.nextFloat();
System.out.print("请输入你的体重:");
Scanner reader2=new Scanner(System.in);
int xin=reader.nextInt();
float BMI=xin/qi/qi;
switch(er){
case 'M':
if(BMI<19)
System.out.println("你的体型过轻!");break;
if(BMI<24||BMI>19)
System.out.println("你的体型适中!");break;
if(BMI<29||BMI>24)
System.out.println("你的体型过重!");break;
if(BMI<34||BMI>29)
System.out.println("你的体型肥胖!");break;
case 'F':
if(BMI<20)
System.out.println("你的体型过轻!");break;
if(BMI<25||BMI>20)
System.out.println("你的体型适中!");break;
if(BMI<30||BMI>25)
System.out.println("你的体型过重!");break;
if(BMI<35||BMI>30)
System.out.println("你的体型肥胖!");break;
}
}
}
public static void main(String[] args) {
System.out.print("您的性别是(M/F):");
Scanner reader=new Scanner(System.in);
char er=reader.next().charAt(0);
System.out.print("请输入你的身高:");
Scanner reader1=new Scanner(System.in);
float qi=reader.nextFloat();
System.out.print("请输入你的体重:");
Scanner reader2=new Scanner(System.in);
int xin=reader.nextInt();
float BMI=xin/qi/qi;
switch(er){
case 'M':
if(BMI<19){
System.out.println("你的体型过轻!");break;}
else if(BMI<24||BMI>19){
System.out.println("你的体型适中!");break;}
else if(BMI<29||BMI>24){
System.out.println("你的体型过重!");break;}
else if(BMI<34||BMI>29){
System.out.println("你的体型肥胖!");break;}
case 'F':
if(BMI<20){
System.out.println("你的体型过轻!");break;}
else if(BMI<25||BMI>20){
System.out.println("你的体型适中!");break;}
else if(BMI<30||BMI>25){
System.out.println("你的体型过重!");break;}
else if(BMI<35||BMI>30){
System.out.println("你的体型肥胖!");break;}
}
}