这是导致问题的方法.我正在创建一个BMI计算器,它使用年龄,体重和身高来计算最终结果.我不确定我的逻辑是否错误或是否还有其他问题
public void calculateClickHandler(View view) {
String Outcome;
Outcome = null;
age = Float.parseFloat(txtHowOld.getText().toString());
feet = Float.parseFloat(txtFt.getText().toString());
inches = Float.parseFloat(txtIn.getText().toString());
pounds = Float.parseFloat(txtWeight.getText().toString());
height = (feet * 12) + inches;
double BMI1 = (pounds / (height * height)) * 703.0;
if (btnF.isChecked()) {
if (age >= 20 && age <= 40) {
if (BMI1 < 21) {
Outcome = "Underweight";
} else if (BMI1 >= 21 && BMI1 <= 33) {
Outcome = "Healthy";
}
else if (BMI1 > 33 …Run Code Online (Sandbox Code Playgroud)