// BMICalculator.java // calculates the BMI based on height and weight // by John Doe public class BMICalculator { public static void main (String[] args) { // declare variables double height; // in inches double weight; // in pounds double bmi; // compute BMI height = 68; weight = 100; bmi = weight / (height * height) * 703; // print results p("Height: " + height); p("Weight: " + weight); p("BMI: " + bmi); commentOnBmi(bmi); // new results p("After a lot of eating..."); weight = weight + 40; bmi = weight / (height * height) * 703; p("Height: " + height); p("Weight: " + weight); p("BMI: " + bmi); commentOnBmi(bmi); } public static void commentOnBmi (double currentBMI) { if (currentBMI < 18.5) { p("You seem to be underweight."); } else if (currentBMI > 24.9) { p("You seem to be overweight."); } else { p("You seem to be just right. :)"); } } public static void p (String s) { System.out.println(s); } }