Question
//JAVA PROGRAM// The body mass index (BMI) is a measure of a persons health status based on the persons weight and height. It is calculated
//JAVA PROGRAM//
The body mass index (BMI) is a measure of a persons health status based on the persons weight and height. It is calculated by taking a persons weight in kilograms and dividing it by the square of persons height in meters:
The interpretation of the BMI for people 16 years and older is as following:
BMI | Interpretation |
Below 18.5 | underweight |
18.5 24.9 | normal |
25.0 29.9 | overweight |
Above 30.0 | obese |
//JAVA PROGRAM//
Write a method called bmi() to calculate the body mass index (BMI). The interface of the bmi() is:
double bmi(double weight, double height)
You need to convert the units from English to Metric measurements. Write two methods called lbsToKg() and ftToM() to do the conversions. You are not allowed to use library functions to do the conversions.
Write a method called healthStatus() to take in appropriate parameters (name, age, weight, height) and display the health status of the person, i.e., Normal, Obese, etc.
Note: you need to check for correct user inputs
Write a main() method to integrate the above methods and allow the user to run the test multiple times.
Run the following test cases to verify your program.
Test case 1:
Name: John
Age: 18
Weight: 255 lbs
Height: 5.9 ft
Test case 2:
Name: Mary
Age: 25
Weight: 95 lbs
Height: 5.2 ft
Test case 3:
Name: Mark
Age: 60
Weight: 135 lbs
Height: 5.6 ft
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started