This Java program calculates the Body Mass Index (BMI) and estimates height based on parental height. The program allows users to choose between the Metric and Imperial measurement systems.
- BMI Calculation: Determines BMI based on user-provided height and weight.
- Height Estimation: Predicts a user's height based on the heights of their parents.
- Unit Conversion Support: Opens a web page for unit conversions if needed.
- The program starts by displaying a disclaimer that it is not intended for medical use.
- The user selects a measurement system:
- Metric (meters, kilograms)
- Imperial (inches, pounds)
- The program automatically opens UnitConverters.net in the default web browser.
- The user chooses an option:
- (1) Calculate BMI
- (2) Estimate Height
- (0) Exit the program
- Based on the choice, the program:
- Calculates and categorizes BMI into underweight, normal, overweight, or obese.
- Estimates height using parental heights and gender-based formulas.
BMI Range | Weight Class |
---|---|
< 18.5 | Underweight |
18.5 - 24.9 | Normal |
25 - 29.9 | Overweight |
≥ 30 | Obese |
The program estimates height based on gender:
- Male:
((Mother's Height + Father's Height + Offset) / 2)
- Female:
((Mother's Height + Father's Height - Offset) / 2)
- Offset: 13 cm (Metric) / 5 in (Imperial)
- Java Development Kit (JDK) installed
- A system that supports Java AWT Desktop (for opening the browser)
- Compile the program:
javac Main.java
- Run the program:
java Main
- Follow the on-screen prompts to enter your data and get results.
- The program does not store or process data beyond user input.
- If the system does not support Desktop browsing, the web page will not open.
- The program runs in a loop until the user selects option
0
to exit.
This program is for informational purposes only and should not be used for medical decisions.