BMI java not working | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

BMI java not working

Hey, I can not get the KG and CM calculation to work, pounds and feet conversion calculates the BMI perfectly. how can I add the Kg and CM calc to the results button??? :( private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { double iHeight = Double.parseDouble(jTextHeightFeet.getText() + jTextHeightInches.getText () ) ; double iWeight = Double.parseDouble(jTexWeightStones.getText()+ jTextWeightPounds.getText () ); double iBMI = iWeight / (iHeight * iHeight) *703; String Calc_BMI =String.format("%.2f" , iBMI); jTextIBM.setText(Calc_BMI);

17th Sep 2017, 11:04 PM
SI MA
SI MA - avatar
1 Answer
+ 10
Pls try to publish a minimal example of your calculations at the playground and then link it here. The example shouldn't contain the gui components, for they won't run here. Put your calculations to two different methods and check if they work if you call them. If not, someone will help you to debug them for sure. You can add the gui components later, first concentrate on the algorithms. Once the calculations are correct, you can check the other components.
23rd Sep 2017, 5:52 PM
Tashi N
Tashi N - avatar