A quantity known as the body mass index (BMI) is used to calculate the risk of weight-related health problems. BMI is computed by the formula

BMI = w/(h/100)^2

Where w is weight in kilograms and h is height in centimeters. A BMI of about 20 to 25 is considered “normal.” Write an application that accepts weight and height (both integers) and outputs the BMI. Use standard Java input/output (System.in with Scanner class and System.out).

The user’s weight and height must be read in and stored as integers. Calculate the BMI (a floating-point number) and display the result. In the calculation, the height is divided by 100 to convert from centimeters to meters. You must define a constant to represent this conversion value (100.0).

Please help me.

Recommended Answers

All 3 Replies

Please check the Member Rules for DaniWeb

"Do provide evidence of having done some work yourself if posting questions from school or work assignments"

Help for initializing Scanner:

Scanner keyBoard = new Scanner(System.in);

The rest are up to you.

I made this type of program once, this is easy, but providing/ exerting effort will do help you a lot . please exert some more effort in posting

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.