I'm supposed to design a program in TextPad to calculate BMI. I can't get the program to calculate the bmi using the formula. This is my code.
import java.util.Scanner;
public class BmiCalculator {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter weight in pounds: ");
double weightInPounds = keyboard.nextDouble();
System.out.print("Enter height in inches: ");
double heightInInches = keyboard.nextDouble();
double bmi = weightInPounds/(heightInInches * heightInInches) * 703;
System.out.println("Your body mass index is" + bmi);
}
}
The output shows:
Enter weight in pounds: 130
Enter height in inches: 66
Your body mass index
Nothing shows for the bmi when I run the program. I compiled the program and TextPad shows no errors. I don't know what is wrong with my code. Can anyone find the error in the code?