Prog26: BMI Calculator Part 1
///Name: Ilana Levy
///Period: 5
///Project Name: BMI Calculator Part 1
///File Name: BMIproj1.java
///Date finished: 9/8/2015
import java.util.Scanner;
public class BMIproj1
{
public static void main( String[] args );
{
Scanner keyboard = new Scanner( System.in );
double m, kg, bmi;
System.out.print( "Your height in m: " );
m = keyboard.nextDouble();
System.out.print( "Your weight in kg: " );
kg = keyboard.nextDouble();
bmi = kg / (m*m);
System.out.println( "Your BMI is " + bmi );
}
}
///Name: Ilana Levy
///Period: 5
///Project Name: BMI Calculator Part 1 Studdy Drills
///File Name BMIdrills.java
///Date finished: 9/8/2015
import java.util.Scanner;
public class BMIdrills
{
public static void main( String[] args )
{
Double heightIn, heightFt, weightP, bmi1, bmi2;
Scanner keyboard = new Scanner( System.in );
System.out.print( "Your height in inches: " );
heightIn = keyboard.nextDouble();
System.out.print( "Your weight in pounds: " );
weightP = keyboard.nextDouble();
System.out.print( "Your BMI is " );
bmi1 = (weightP * 0.4536) / (heightIn * 0.025 * heightIn * 0.025 );
System.out.print( "Your height (feet only): " );
heightFt = keyboard.nextDouble();
System.out.print( "Your height (inches): " );
heightIn = keyboard.nextDouble();
System.out.println( "Your weight in pounds: " + weightP);
bmi2 = (weightP * .4536) / ((heightFt * 12 + heightIn) * 0.025 * (heightFt * 12 + heightIn) * 0.025) ;
System.out.println( "Your BMI is " + bmi2);
}