Bug with my program of gpa calculator: shows divide 0 by 0 when run in emulator

GPACalculator (4).aia (11.4 KB)
For detail please look at the aia file above.





Welcome Bill.

when run in emulator'
What happens when you run the code on a cell phone or tablet?

You probably can find the Block that is causing the error by searching for any of your Blocks that contain the Math / divide symbol. Do you have more Blocks than you already posted? I don't see anywhere you are dividing. :cry:

The issue could also be related to how you set your initial values. Setting them to 0 and immediately using them without assigning a value greater than 0 could cause something like this.

1 Like

Change


to

(see the bottom.)

Also, you never reset total Credits when recalculating.

I changed and now the result is simply zero. Is there a problem with the procedure?

https://ai2.appinventor.mit.edu/reference/other/testing.html
What did you change?

What you did to resolve divide zero by zero shows one of the variables that was giving you the original issue.

Possibly. Here is some general advice about how to debug

https://ai2.appinventor.mit.edu/reference/other/testing.html

1 Like

Try applying Do It to each of those value procedure calls, to see what they return.

1 Like