Question: Create a program to calculate the Body Mass Index (BMI) for a person. BMI can be calculated using one of the following two formulas (more
- Create a program to calculate the Body Mass Index (BMI) for a person. BMI can be calculated using one of the following two formulas (more detail here: http://www.whathealth.com/bmi/formula.html (Links to an external site.)):
- Metric: BMI = weight (in kg) / height2 (in m) Example: BMI = 72 kg / (1.80 m)2 = 72 / 3.24 = 22
- Imperial: BMI = weight (in lb) * 703 / height2 (in inches) Example: BMI = 158 lb * 703/ (71)2 = 111074 / 5041 = 22
BMI is used to determine if someone is overweight according to the following categories:
- underweight (BMI less than 18.5)
- normal weight (BMI between 18.5 & 24.9)
- overweight (BMI between 25.0 & 29.9)
- obese (BMI 30.0 and above)
Create the following methods:
- LbToKg: Takes a double representing a weight in pounds. It returns the converted weight in kilogram.
- InchesToMeters: Converts a given measurement in inches to meters.
- BMIMetric: Takes the necessary values as parameters to calculate BMI using metric values. Returns the BMI value.
- BMICategory: Given a particular BMI value, this method returns the corresponding category (underweight, normal weight etc).
Include some way for the user to enter weight and height (you choose the units you will allow the user to enter), then display the corresponding BMI as well as which category the person is in. Can be done using console or form.
*using C#
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
