# Body Mass Index (BMI) Calculator in Java

The program below is the answer to Deitel's Java How to Program (9th Edition) Chapter 2 Exercise 2.33.

Question: The Formulas for calculating BMI are:

Create a BMI calculator that reads the user’s weight in pounds and height in inches (or, if you prefer, the user’s weight in kilograms and height in meters), then calculates and displays the user’s body mass index. Also, display the following information from the Department of Health and Human Services/National Institutes of Health so the user can evaluate his/her BMI:

BMI VALUES

Underweight: less than 18.5
Normal: between 18.5 and 24.9
Overweight: between 25 and 29.9
Obese: 30 or greater

```/**
*
* @Author: Aghatise Osazuwa
* Website: www.cscprogrammingtutorials.com
*
* Exercise 2.33 - Body Mass Index Calculator
* This Program Calculates And Displays A User's Body Mass Index (BMI)
*
*/

import java.util.Scanner;

public class Ex02_33 {
public static void main (String [] args) {

Scanner input = new Scanner (System.in);

int weight;
int height;
int bMI;

System.out.print ("Enter Your Weight in Pounds: ");
weight = input.nextInt();
System.out.print ("Enter Your Height in Inches: ");
height = input.nextInt();
bMI = (weight * 703) / (height * height);
System.out.printf ("Your Body Mass Index (BMI) is %d\n\n", bMI);

System.out.println ("BMI VALUES");
System.out.println ("Underweight: less than 18.5");
System.out.println ("Normal:      between 18.5 and 24.9");
System.out.println ("Overweight:  between 25 and 29.9");
System.out.println ("Obese:       30 or greater");

}
}
```

1. define application that compute person Body Fat Index “BFI”

Do you have a solution for this problem ?

1. Hi 5faya,
If you understood the program above, I think you should be able to solve the problem yourself. Its just knowing the right formula and converting it to a java program or any other programming language.

If you cannot solve it after trying it yourself, tell me the formula for calculating BFI and then I can help you.

2. simple code but i think it's very useful for other that need this, especially for a student that studying java

3. I want to know if the weight * 703 is converting the weight to kg, if then we need to also convert the inches to metres.

DISCLAIMER: Opinions expressed in comments are those of the comment writers alone and does not reflect or represent the views of the post author. We reserve the right to delete any post deemed inappropriate or offensive and/or spammy. Please do not use abusive words/hate speech.

I Appreciate your valuable Feedback. So, Please DO NOT SPAM - Spam comments will be deleted immediately.

Don't use brand name in name field and you're not allowed to use links in comments unless it's necessary. Such comments will be removed immediately. To get notified of replies or follow-up comments, click the box next to notify me.

Thanks.