import java.util.*; public class BodyMassIndex { public static final int BMI_FACTOR = 703; public static void main(String[] args) { Scanner console = new Scanner(System.in); double bmi1 = processPerson(console); double bmi2 = processPerson(console); System.out.println("Person #1 body mass index = " + bmi1); System.out.println("Person #2 body mass index = " + bmi2); System.out.println("Difference = " + (bmi1 - bmi2)); } public static double processPerson(Scanner console) { System.out.println("Enter next person's information:"); System.out.print("height (in inches)? "); double height = console.nextDouble(); System.out.print("weight (in pounds)? "); double weight = console.nextDouble(); System.out.println(); return calculateBMI(weight, height); } public static double calculateBMI(double weight, double height) { double bmi = weight / Math.pow(height, 2) * BMI_FACTOR; return bmi; } }