IBM体质测试 结合Scanner类的使用 Scanner类的使用敲此处 import java.util.Scanner; public class Practice { public static void main(String[] args){ System.out.println("你的体重是(kg):"); Scanner s=new Scanner(System.in); float a = s.nextFloat(); System.out.println("你的身高是(m):"); float b = s.nextFloat(); System.out.println("你的BIM为:"+(a/(b*b))); float c=a/(b*b); if(c<18.5){ System.out.println("体质判断:体质过轻"); }else if(c>=18.5&& c<24){ System.out.println("体质判断:正常"); } else if(c>=24&&c<27){ System.out.println("体质判断:体重过重"); }else if(27<=c&&c<30){ System.out.println("体质判断:轻度肥胖"); }else if(c>=30 && c< 35){ System.out.println("体质判断:中度肥胖"); }else{ System.out.println("体质判断:重度肥胖"); } } }