私は現在bmi計算機を作成しようとしていますが、2つの異なる値(フィートとインチ)をキャッチして確認する方法がわからないため、人の身長のフィートとインチをインチ単位の1つの値にしようとしています。彼ら。
パブリッククラスBMI{
public static void main (String[] args)
{
System.out.println("Value between 2 and 7: " + heightInInches(2,7));
System.out.println("Value between 0 and 11: " + heightInInches(0,11));
System.out.println("Value between 3 and 30: " + weightInPounds(3,30));
System.out.println("Value between 0 and 13: " + weightInPounds(0,13));
}
public static int heightInInches(int lower, int upper)
{
Scanner kybd = new Scanner(System.in);
System.out.printf("Enter your height between %d and %d: ", lower, upper);
int height = kybd.nextInt();
while (height < lower || height > upper)
{
System.out.printf("Retry between %d and %d:" , lower, upper);
height = kybd.nextInt();
}
return height;
}