Assignemnt #26
Code
/// Name: Carlos Sosa
/// Period: 6
/// Program Name: BMICalculator
/// File Name: BMICalculator.java
/// Date Finished: 10/2/15
import java.util.Scanner;
class BMI{
public static void main(String[] args) {
double heightf, inches, weight, heightm, heightmm, htotal, weightt, bmi;
Scanner keyboard = new Scanner(System.in);
System.out.print( "your height (feet): " );
heightf = keyboard.nextDouble();
System.out.print( "Your height (inches): " );
inches = keyboard.nextDouble();
System.out.print("Your weight (pounds): ");
weight = keyboard.nextDouble();
heightm = heightf * 0.3048;
heightmm = inches * 0.0254;
htotal = heightm + heightmm;
weightt = weight * 0.453592;
bmi = weightt / (htotal*htotal);
System.out.println("Your BMI is " + bmi);
}
}
Picture of the output