Assignemnt #26: BMI Calculator Part 1
Code
/// Name: Kelsey Lieberman
/// Period 5
/// Program Name: BMICalculator
/// File Name: BMICalculator.java
/// Date Finished: 10/5/2015
import java.util.Scanner;
public class BMICalculator
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
double m, kg, bmi, wt_lb, height, ht_in, ht_ft;
System.out.print("Your height (feet only): ");
ht_ft = keyboard.nextDouble();
System.out.print("Your height (inches): ");
ht_in = keyboard.nextDouble();
System.out.print("Your weight in pounds: ");
wt_lb = keyboard.nextDouble();
height = ((ht_ft * 12) + ht_in);
kg = (wt_lb * 0.453592);
m = (height * 0.0254);
bmi = kg/(m*m);
System.out.println("Your BMI is: " + bmi );
}
}
Picture of the output