A person’s BMI (Body Mass Index) is calculated by dividing the person’s weight (in kilograms) by the square of their height (in metres), then rounding the result to the nearest whole number. A healthy BMI is considered to be within the range 19 to 25.
The CalculateBMI program shown below is supposed to calculate a person’s BMI.
The user enters their weight and height when prompted, and the program then calculates
and displays the user’s BMI.
For example, if the user weighs 61.5 kilograms and is 1.64 metres in height, the output
should look as follows:
Enter your weight in Kilograms: 61.5
Enter your height in Metres: 1.64
Your BMI is: 23
There are 10 errors or omissions in the source code below. Please find and correct it.
// program to calculate Body Mass Index (BMI)
public class CalculateBMI {
public start() {
System.out.println("Enter your weight in Kilograms: ");
int weight = Double.parseDouble(Keyboard.readInput());
System.out.print(Enter your height in Metres: ");
double height = Integer.parseInt(Keyboard.readInput);
double bodyMassIndex = weight / height * height);
System.out.print("Your BMI is: ")
System.out.println(Math.round(BodyMassIndex));
}