i'm new here and also coding, i'm doing my course conclusion project and having difficulties to find where is the error. Basically my code are:
kilograms = Double.parseDouble(kgTextField.getText());
meters = Double.parseDouble(metersTextField.getText());
pounds = Double.parseDouble(poundsTextField.getText());
inches = Double.parseDouble(inchesTextField.getText());
result = (kilograms) / (meters * meters);
resultTextField.setText(String.format("%,.2f", result ));
The result is giving me a NaN value and i'm not finding where is the error. I'm doing the conversion from string to double in the variables but still doesn't work. Can someone give me a light?
Cheers