Question: Problem 2: [15 marks] Check a persons body mass index (filename: CheckBMI.java ) The Body Mass Index (BMI) is often used by scientists and physicians
Problem 2: [15 marks] Check a persons body mass index
(filename: CheckBMI.java)
The Body Mass Index (BMI) is often used by scientists and physicians to determine whether a person is underweight or overweight. The formula for calculating BMI is:
bmi = weight / height2
Design an algorithm and then write a program that gets a persons weight (kg) and height (m) from the console. If the weight or the height is not positive, display an appropriate error message on the console before exiting the program. Otherwise the program calculates and checks a persons BMI. If the persons BMI is below 20, display You are underweight, else if it is above 25, display You are overweight, else display Your BMI is normal. Display the persons BMI (keep two decimals) and the status message on the console.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
