计算题指数

package computerPractice;

import java.util.Scanner;

public class BMIIndex {

public static void main(String[] args) {

	Scanner sc = new Scanner(System.in);

	System.out.println("##########BIM检测##########");
	System.out.print("请输入您的体重:");
	double weight = sc.nextDouble();
	System.out.print("请输入您的身高:");
	double stature = sc.nextDouble();

	double BMI = weight / (stature * stature);
	if (BMI < 18) {
		System.out.println("\n提示:您的BMI值为:" + String.format("%.2f", BMI) + ",测量结果为体重偏轻!");
	} else if (BMI > 18 && BMI <= 25) {
		System.out.println("\n提示:您的BMI值为:" + String.format("%.2f", BMI) + ",测量结果为体重正常!");
	} else if (BMI > 25 && BMI <= 30) {
		System.out.println("\n提示:您的BMI值为:" + String.format("%.2f", BMI) + ",测量结果为超重!");
	} else if (BMI > 30 && BMI <= 35) {
		System.out.println("\n提示:您的BMI值为:" + String.format("%.2f", BMI) + ",测量结果为轻度肥胖!");
	} else if (BMI > 35 && BMI <= 40) {
		System.out.println("\n提示:您的BMI值为:" + String.format("%.2f", BMI) + ",测量结果为中度肥胖!");
	} else if (BMI > 40) {
		System.out.println("\n提示:您的BMI值为:" + String.format("%.2f", BMI) + ",测量结果为高度肥胖!");
	}

	sc.close();

}

}

posted @ 2021-09-09 18:56  时凯  阅读(39)  评论(0)    收藏  举报