Assignemnt #26: BMI Calculator
Code
/// Name: Sean Harrison
/// Period: 7
/// Program name: BMI calculator
/// File Name: BMICalculator.java
/// Date Finished: 9/30/2015
import java.util.Scanner;
public class BMICalculator
{
public static void main( String[] ags )
{
Scanner keyboard = new Scanner(System.in);
double ft, in, lbs, m, kg, bmi;
System.out.print( "Your height in feet: " );
ft = keyboard.nextDouble();
System.out.print( "Your height in inches: " );
in = keyboard.nextDouble();
m = ((ft * 12) + in) * 2.54 / 100;
System.out.print( "Your weight in pounds: " );
lbs = keyboard.nextDouble();
kg = lbs * .454;
bmi = kg / (m*m);
System.out.println( "Your BMI is " + bmi );
}
}
Picture of the output