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