Gpa calculator issues

Thank you so much! :pray: :pray: :pray:

By the way, the procedure I fixed needs parameters for the row of your input table, to avoid duplicating that code for each new input row.

You get a greatly reduced block count by calling the procedure once for each row, feeding it the current row's data.

Check the other half dozen gpa apps I fixed on this board today for sample code.

1 Like

after checking the apk, I find out that the value Calc_point_x_credit equals to zero for some reason
it seems like i the point value is not extracted from the dictionary, how can i fix that?
image

also, the parameters others have does not neccessarily fix my case or i cant seem to figure out how to add in a reduce procedure block

heres what ive got
gpacalculator (3).aia (8.2 KB)

Calc_point_x_Credit is still zero

ηŽ‹δΏŠε€«θƒ½δΈθƒ½ε₯½ε₯½ε¬θ―ΎοΌŸ

Try using the companion's Do It facility to trace the data flow in your app.

A well designed procedure does not change global variable values.

Split the procedure into smaller functions and do global variable updates via the call blocks.

The problem is that i know whats wrong but i dont know how to fix it
the values i have in the dictionary can not conect to the specific grades and therefore causing Calc_point_x_Credit to be zero

http://www.appinventor.org/book2

Read chapter 21, procedures,

You need to compose value procedure calls for table lookups

You need small value procedures you can use like pipe fittings.

  • A procedure that takes a number grade and returns a letter grade
  • A procedure that takes a letter grade and a level code and a course credit and returns a grade point value for the course
  • A procedure that takes a course name and returns its course credit

What did I miss?

Leave it to the higher level calling code to do the math combining those results.

He sounds bright.

I have not seen the course in question, and can only offer an extra eye and some useful patterns.

I am supposed to be asleep, and can't open aia files till morning.

Here is a draggable result procedure header that can wrap any code:
result_procedure_sandwich

Drag it into your code, and rename it, then fill it with whatever blocks you have.

Here's a rework according to what I recommended.


gpacalculator3 (1).aia (8.5 KB)

You could improve it further by making the before picking and after picking events generic, to reduce block count after you duplicate Designer input rows.

By the way, now is a good time to switch from Table Arrangements to nested Vertical and Horizontal Arrangements.

Table Arrangements have been known to get buggy when you edit them.

The output is still zero somehow
is it because i haven't break the loop within the gpa button click or is it just some random problem?

still, after stoping the loop with a break, the output is still shown to be 0
after debugging, Calc_point_x_Credit is 0 when the code functions
I honestly have no clue what so ever

What version of the code are you running?

Did you add extra rows?

Did you feed blanks into the input?
There is no validation yet.

I did not add any extra rows nor did i feed blanks into the input
i am running the code that you recommended to figure the logic out and while im testing the codes, the output is zero