Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Sheriffs:
Saloon Keepers:
Bartenders:

# reverse bmi formula

Ranch Hand
Posts: 196
My program is to calculate the users BMI as well as tell the user what their weight should be according their goal bmi
the trouble I am having is on line 8 with the goal weight, I cannot think of what the formula should be, I have tried formulas such as

Marshal
Posts: 58366
178
bmi = weight ÷ height²
Multiply each side by height²
bmi × height² = weight
I think that is it.
Desired BMI = 23. Height = 1.7. 1.7² = 2.89. 23 × 2.89 = 66.47

Campbell Ritchie
Marshal
Posts: 58366
178
Where does 703 come from? I have never heard of other units than kg and m for BMI, so maybe 703 is a unit conversion factor.

Sheriff
Posts: 23451
46

kennith stomps wrote:I cannot think of what the formula should be

Start by writing down the formula for BMI as a function of height and weight. It will look like "BMI = ... (something) ...", where "something" is a function of weight and height. Next, solve that equation for the weight value. Your solution will look like "weight = ... (something) ...", where "something" is a function of BMI and height. You learned how to do basic algebra like that already, right?

Finally take your solution and implement it in Java.