Assignment #26 and BMI Calculator
Code
///Name: Tim Gibson
///Period: 6
///Project Name: BMI Calculator
///File Name: BMI.java
///Date Finished: 9/24/15
import java.util.Scanner;
public class BMI
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
double m, kg, bmi, ft, in, hIn, lb;
System.out.print( "Your height (feet only): " );
ft = keyboard.nextDouble();
System.out.print( "Your height (inches only): " );
in = keyboard.nextDouble();
System.out.print( "Your weight in pounds: " );
lb = keyboard.nextDouble();
hIn = ( 12 * ft ) + in;
m = hIn * .0254;
kg = lb / 2.2046;
bmi = kg / (m*m);
System.out.println( "Your BMI is " + bmi );
}
}
Picture of the output