Assignment #26
Code
/// Gian Adoremos
/// Period: 7
/// Program Name: TwentyFourth Program
/// 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 inches, lbs, bmi, conv1, conv2, kg, m;
conv1 = 0.0254; //inches to meters
conv2 = 0.45359; //pounds to kilograms
{
System.out.print( "Your height in inches: " );
inches = keyboard.nextDouble();
System.out.print( "Your weight in pounds: " );
lbs = keyboard.nextDouble();
kg = lbs*conv2;
m = inches*conv1;
bmi = kg / (m*m);
System.out.println( "Your BMI is " + bmi );
}
}
}
Picture of the output