Java语言程序设计基础篇_第十版编程_医疗应用程序:计算BMI
package nameyu;import java.util.Scanner;public class Test { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner input=new Scanner(System.in); System.out.print("Enter weight in pounds:"); double weight=input.nextDouble(); System.out.print("Enter height in inches:"); double height=input.nextDouble(); double rice=height*0.0254; double kg=weight*0.45359237; double BMI=kg/(rice*rice); System.out.println("BMI is"+BMI); }}
页:
[1]