// this line must be included to use Dialog Boxes import javax.swing.JOptionPane; public class BMICalculator2 { public static void main(String[] args) { // declare variables for input int feet, inches, weight; // declare variables for calculations/output double height, BMI; // declare String variables for the Dialog boxes String input; String output; // Prompt user to enter initial values in Dialog Boxes input = JOptionPane.showInputDialog("Enter feet of height (6'1\" enters 6):"); feet = Integer.parseInt(input); input = JOptionPane.showInputDialog("Enter inches of height (6'1\" enters 1):"); inches = Integer.parseInt(input); input = JOptionPane.showInputDialog("Enter weight in pounds:"); weight = Integer.parseInt(input); // compute the BMI height = 12.0*feet + inches; BMI = 703.0*weight/(height*height); // form output string output = "Your BMI is " + BMI + "\n"; // START OF MODIFIED CODE if (BMI<=15.0) { output += "(meaning you are in Starvation)\n"; } else if (BMI<=18.5) { output += "(meaning you are Underweight)\n"; } else if (BMI<=25.0) { output += "(meaning you are Normal)\n"; } else if (BMI<=30.0) { output += "(meaning you are Overweight)\n"; } else if (BMI<=40.0) { output += "(meaning you are Obese)\n"; } else { output += "(meaning you are Morbidly Obese)\n"; } // END OF MODIFIED CODE // print answer in a Dialog Box JOptionPane.showMessageDialog(null, output); } }