Could someone please tell me if this looks right...
import jpb.*;
public class Program1{
public static void main(String[] args) {
//Declare constant values
final double POUNDS_PER_KILOGRAM = 2.2;
final double INCHES_PER_METER = 39.37;
final double INCHES_PER_FOOT = 12;
//Declare variables used to store user input
String userInput;
double feet;
double inches;
double weightInPounds;
//Get the user's heigh (feet only)
System.out.print("Enter height in feet: ");
userInput = SimpleIO.readLine();
feet = Double.parseDouble(userInput);
//Get the user's heigh (inches only)
System.out.print("Enter height in inches: ");
userInput = SimpleIO.readLine();
inches = Double.parseDouble(userInput);
//Get the user's weight (in pounds)
System.out.print("Enter weight in pounds: ");
userInput = SimpleIO.readLine();
weightInPounds = Double.parseDouble(userInput);
//Declare variables used for calculations
double totalHeightInInches;
double totalHeightInMeters;
double weightInKilograms;
double bodyMassIndex;
//Calculate the user's total height in meters
totalHeightInInches = feet * INCHES_PER_FOOT + inches;
totalHeightInMeters = totalHeightInInches / INCHES_PER_METER;
//Convert the user's weight to kilograms
weightInKilograms = pounds / POUNDS_PER_KILOGRAM;
//Calculate the Body Mass Index
bodyMassIndex = weightInKilograms * weightInKilograms / totalHeightInMeters
//Display their height and weight
System.out.println();
System.out.print("You are " + feet + " feet " + inches + " inches or ");
System.out.println(totalHeightInMeters + " meters tall");
System.out.println("You weigh " + weightInPounds + " pounds");
//Diplay their calculated Body Mass Index
System.out.println();
System.out.print("Your Body Mass Index is " + bodyMassIndex);
System.out.println();
}
}
Does this look right?
I'm not sure about this part...
//Diplay their calculated Body Mass Index
System.out.println();
System.out.print("Your Body Mass Index is " + bodyMassIndex);
System.out.println();
Because on a previous program, that part had 4 lines and mine only has 2.

