小编con*_*nor的帖子

错误方法太复杂,无法通过数据流算法进行分析

这是导致问题的方法.我正在创建一个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)

css java android

9
推荐指数
1
解决办法
9959
查看次数

标签 统计

android ×1

css ×1

java ×1