BMI Calculator Part 1
Code
/// Name: Rachel Smith
/// Period: 5
/// Program Name: BMI Calculator Part 1
/// File Name: BMICalculatorPart1.java
/// Date Finished: 9/24/2015
import java.util.Scanner;
public class BMICalculatorPart1 {
public static void main( String[] args ) {
Scanner keyboard = new Scanner(System.in);
double m, kg, bmi;
int ft, in, lbs;
System.out.print( "Your height (feet only): " );
ft = keyboard.nextInt();
System.out.print( "Your height (inches): " );
in = keyboard.nextInt();
m = (ft+(in / 12))*0.3048;
System.out.print( "Your weight in lbs: " );
lbs = keyboard.nextInt();
kg = lbs*0.453592;
bmi = kg / (m*m);
System.out.println( "Your BMI is " + bmi );
}
}
Picture of the output