糖尿病康复,内容丰富有趣,生活中的好帮手!
糖尿病康复 > Java *2.14(医疗应用程序:计算BMI)身体质量指数(BMI)是对体重的健康测量。

Java *2.14(医疗应用程序:计算BMI)身体质量指数(BMI)是对体重的健康测量。

时间:2021-05-01 18:04:23

相关推荐

Java *2.14(医疗应用程序:计算BMI)身体质量指数(BMI)是对体重的健康测量。

它的值可以通过将体重(以公斤为单位)除身高(以米为单位)的平方值得到。编写程序,提示用户输入体重(以磅为单位)以及身高(以英寸为单位),然后显示BMI。

注意:一磅是0.45359237公斤,一英寸是0.0254米。

下面是一个运算示例:

Enter weight in pound: 95.5

Enter hight in inches: 50

BIM is 26.8573

package Second;import java.util.Scanner;public class Code14 {public static void main(String[] args) {System.out.print("Enter weight in pound: ");Scanner input = new Scanner(System.in);double weight = input.nextDouble();System.out.print("Enter hight in inches: ");double hight = input.nextDouble();double BIM = 0;BIM = weight * 0.45359237 / (hight * hight * 0.0254 * 0.0254);System.out.println("BIM is " + BIM);}}

输出

Enter weight in pound: 95.5Enter hight in inches: 50BIM is 26.857257942215885

如果觉得《Java *2.14(医疗应用程序:计算BMI)身体质量指数(BMI)是对体重的健康测量。》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。