0% found this document useful (0 votes)
49 views1 page

Java BMI Calculator Assignment

Uploaded by

Jake Paras
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views1 page

Java BMI Calculator Assignment

Uploaded by

Jake Paras
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Assignment: Java BMI Calculator

Instructions: Create a BMI Calculator Using if Conditions Only

Objective:
Write a Java program that calculates a person’s Body Mass Index (BMI) and displays
their weight category using only if statements.

Formula for BMI:

BMI=weight in kilograms(height in meters)2BMI = \frac{\text{weight in


kilograms}}{(\text{height in meters})^2}BMI=(height in meters)2weight in kilograms

Weight Categories (WHO Standard):

o BMI < 18.5 → Underweight

o BMI ≥ 18.5 and < 25 → Normal weight

o BMI ≥ 25 and < 30 → Overweight

o BMI ≥ 30 → Obese

Steps to Follow:

1. Create a Java class named BMICalculator.


2. Import [Link] to take input from the user.
3. Ask the user to enter their weight (kg) and height (m).
4. Compute the BMI using the formula.
5. Use only if statements (no else or else-if) to check each category.
6. Print the corresponding message for the user’s BMI.
7. Display the calculated BMI up to two decimal places.

Sample Output:

Submission:

Submission will be for your own program to be personally run on Friday, August 15, 2025
in Room 2, and should be able to explain the Code submitted.

Prepared by: Jhake D. Paras

You might also like