public static void decide(double bmi) { if (bmi < THRESHOLD_UNDERWEIGHT) { SimpleIO.println("Underweight"); } else if (bmi < THRESHOLD_OVERWEIGHT) { SimpleIO.println("Normal weight"); } else { SimpleIO.println("Overweight"); } }
public static void main(String[] args) { double weight; double height; double bmi; SimpleIO.println("Enter weight [kg]"); weight = SimpleIO.readDouble(); SimpleIO.println("Enter height [m]"); height = SimpleIO.readDouble(); bmi = weight / height / height; SimpleIO.println("BMI = " + bmi); decide(bmi); }