Assignemnt #26 and BMI Calculator
Code
///Name: Daniel Tiffany-Appleton
///Period: 7
///Program Name: BMI Calculator
///File Name: BMICalculator
///Date Finished: 9/25/15
import java.util.Scanner;
public class BMICalculator
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
double m, kg, bmi, inches, inchesTogether, pounds, feet, feetInInches;
System.out.print( "Your height (feet only): " );
feet = keyboard.nextDouble();
feetInInches = feet*12;
System.out.print( "Your height (inches): " );
inches = keyboard.nextDouble();
inchesTogether = inches + feetInInches;
m = inchesTogether*0.0254;
System.out.print( "Your weight in pounds: " );
pounds = keyboard.nextDouble();
kg = pounds*0.453592;
bmi = kg / (m*m);
System.out.println( "Your BMI is " + bmi );
}
}
Picture of the output