• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps need help on division and displaying the value

currycrab

Newbie
when i press calculate. it crash. it looks like there is some problem displaying the result of the division. hope anyone who encountered this problem can help me. thanks alot in advance.


Code:
protected void showResult(Editable first, Editable second, Editable third,
                              Editable forth, Editable fifth, Editable sixth)
    {
    float num1 = Float.parseFloat(first.toString());
    float num2 = Float.parseFloat(second.toString());
    float num3 = Float.parseFloat(third.toString());
    float num4 = Float.parseFloat(forth.toString());
    float num5 = Float.parseFloat(fifth.toString());
    float num6 = Float.parseFloat(sixth.toString());
    float resultModuleCredits = num1 + num2 + num3;
    float resultGPA = num4 + num5 + num6;
    double result = (resultModuleCredits * resultGPA)/resultModuleCredits;
    Result.setText(String.valueOf(result));


    }
 
Back
Top Bottom