赞
踩
- //体重标准测试
- import java.util.Scanner;
- public class Study4 {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
-
- System.out.print("Enter weight in pounds (kg) : ");
- double weight = input.nextDouble();
- System.out.print("Enter height in inches (m) : ");
- double height = input.nextDouble();
-
- double bmi = weight / (height * height);
-
- System.out.println("Your BMI is " + bmi);
- if (bmi < 16)
- System.out.println("轻度偏瘦");
- else if (bmi < 24)
- System.out.println("正常体重");
- else if (bmi < 27)
- System.out.println("体重过重");
- else if (bmi < 30)
- System.out.println("轻度肥胖");
- else if (bmi < 35)
- System.out.println("中度肥胖");
- else
- System.out.println("严重肥胖");
-
- }}
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。