/* Chapter 3 The Body Mass Index Calc Jim Miller September 19.2002 Filename: BodyMass.java Function: This class calculates a person's body mass based on his/her height and weight. */ import java.io.*; public class BodyMass { public static void main( String[] args) throws IOException { String height, weight; int inches, pounds; double kilograms, meters, index; BufferedReader dataIn = new BufferedReader(new InputStreamReader(System.in)); System.out.println("\tTHE SUN FITNESS CENTER BODY MASS INDEX CALCULATOR"); System.out.println("\t\tEnter your height to the nearest inch: "); height = dataIn.readLine(); inches = Integer.parseInt(height); System.out.println("\t\tEnter your weight to the nearest pound: "); weight = dataIn.readLine(); pounds = Integer.parseInt(weight); meters = inches / 39.36; kilograms = pounds /2.2; index = kilograms / Math.pow(meters,2); System.out.println(); System.out.println("\tYOUR BODY MASS INDEX IS " + Math.round(index) + "."); System.out.println(); System.exit(0); } // End of method main } // End class BodyMass