Assignemnt #48 and BMI Calculator pt 2
Code
///Name: Ben Borglin
///Period: 6
///Program Name: BMI Caluclator
///File Name: BMICalc.java
///Date Finished: 10/6/15
import java.util.Scanner;
public class BMICalc
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
double f, lb, bmi, kg, m, in;
System.out.print( "Your height (Feet Only): " );
f = keyboard.nextDouble();
System.out.print( "Your height (Inches Only): " );
in = keyboard.nextDouble();
System.out.print( "Your weight in pounds: " );
lb = keyboard.nextDouble();
m = ((f*12)+in)*0.0254;
kg = lb*.453592;
bmi = kg / (m*m);
System.out.println( "Your BMI is " + bmi );
if (bmi < 18.4)
{
System.out.println("You are underweight.");
}
if (bmi >= 18.5 && bmi <= 24.9 )
{
System.out.println("You are normal weight.");
}
if (bmi >= 25 && bmi <= 29.9)
{
System.out.println("You are overweight.");
}
if (bmi >= 30)
{
System.out.println("You are obese.");
}
}
}
Picture of the output