Assignemnt #26 BMI Calculator Part 1
Code
///Name: Prooz Fereydouni
///Period: 7
///Project Name: BMI Calculator Part 1
///File Name: BC.java
///Date: 9/25/2015
import java.util.Scanner;
public class BC
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
double ft, inch, lb, m, kg, bmi;
System.out.print( "Your height (feet only): " );
ft = keyboard.nextDouble();
System.out.print( "Your height (inches): " );
inch = keyboard.nextDouble();
System.out.print( "Your weight in pounds: " );
lb = keyboard.nextDouble();
kg = lb * 0.453592;
m = ( ft * 0.3048 ) + ( inch * 0.0254);
bmi = kg / (m*m);
System.out.println( "Your BMI is " + bmi );
}
}
Picture of the output