Skip to first unread message

ALI Alshabe

unread,
Sep 19, 2015, 5:12:33 PM9/19/15
to MIT App Inventor Forum

I have a problem I want to make a program to calculate the cumulative grade point average or gpa but I can I find a way to collect and divide numbers quickly to show the gross So is there any way how to do it I have to put lists for the selection of signs such (A +, A, A-) and I have put a number to each marker And I have put 7 lists, but all I want is if you choose, such as A. sign of each list and I have put a number of hours, the program will multiplying the number of hours with an A., which means 4 for each field and then collects all fields outputs and divided on the their number That means if she had four fields must be split on 4 I hope to respond to my question quickly sorry for my bad Language

GPA_Cal.aia

Scott Ferguson

unread,
Sep 19, 2015, 10:18:41 PM9/19/15
to MIT App Inventor Forum

For my solution to calculate the GPA, I first built a list of letter grade, value pairs.

Then I used each listpicker selection letter grade to do a lookup in pairs to get the value associated with the letter grade to add to a total points variable.
the GPA was calculated from the total points divided by the number of classes entered by the user.
---
sf


Message has been deleted

ALI Alshabe

unread,
Sep 20, 2015, 8:50:20 AM9/20/15
to MIT App Inventor Forum

thank you
But the way did not work I have do all what is stated in the picture that you sent to me but when I press on the Calculate  button and he show to my a Error so i will send .aia file and I hope that you correct Error and send the file to me again
GPA_Cal.aia

Abraham Getzler

unread,
Sep 20, 2015, 5:30:19 PM9/20/15
to MIT App Inventor Forum
It looks like you are trying to calculate the grade of a course you never completed
or never took, from the error message's inclusion of 'not found'
in the addition process.

A tiny improvement would be to replace "not found" with 0 in your
lookup in pairs blocks.

A bigger improvement would be to move to a list of lists solution,
where your list of list only contains courses you took and received grades for,
and each sublist contains course name and grade .

See the lists section of my FAQ ...


ABG


Scott Ferguson

unread,
Sep 21, 2015, 12:22:28 AM9/21/15
to MIT App Inventor Forum
It was easiest for me to include the blocks that I would use.
You may be able to incorporate some of that into your project.

---

sf






GPA_Cal_copy.aia

ALI Alshabe

unread,
Sep 21, 2015, 8:52:24 AM9/21/15
to MIT App Inventor Forum
I could not find what I want
Or I did not understand you what I want to do first, I have 7 maximum fields Let us assume that you put the number 7 the program will appears to me 14 Field 7 for hours and seven field to choose marks When selecting the mark A of every list and put five hours in each field the program will multiplying the number of hours and the sign selected that means A which means 4 . This means that  each field will gives an answer which is 20 and the program will collect the fields and the result will be 140 and then dividing on the number of fields and the result will be 20
Please reply to quickly and thank you for your patience 

Abraham Getzler

unread,
Sep 21, 2015, 10:43:51 AM9/21/15
to MIT App Inventor Forum
If I am reading ALI's post correctly,
Ali needs a weighted GPA according to the number of
hours per each course?

If so, this data model would be appropriate:

Course Catalog (describes the school standards):
  Course Name (unique)
  Hours

Student's grades (describes one student's grades for the courses he took)
  Course Name  (must match a Course Name from Course Catalog)
  Letter Grade

Grade Points  (describes how to turn a grade into point factor)
  Letter Grade (unique)
  point factor

So the algorithm to get a weighted GPA would be (correct me if I'm wrong)

Total_Hours = 0
Total_Points = 0
For each (course name, letter grade) in Student's Grades
   Hours = lookup in pairs (Course Catalog, Course Name)
   Points = lookup in pairs (Grade Points, letter grade) 
   Total_Hours = Total_Hours +  Hours
   Total_Points = Total_Points + (Hours * Points)
end For loop
Weighted_GPA = Total_Points / Total_Hours

ABG

Scott Ferguson

unread,
Sep 21, 2015, 5:11:30 PM9/21/15
to MIT App Inventor Forum
Calculating a GPA where course hours are involved is explained > here <.
Multiply the hours attempted for each course by the grade value earned to get quality points.

Add all the quality points for all courses then divide by the total hours for all courses to get the GPA.

So if in one 1 hour course gets an F and one 3 hour course gets an A then that would be 0 x 1 + 3.0 x 3 /( 1 + 3) = 2.25 GPA
---
sf

ALI Alshabe

unread,
Sep 22, 2015, 10:15:19 AM9/22/15
to mitappinv...@googlegroups.com

I have make Explain to understand you and to explaining my purpose and what exactly I want to do so please can you make the program and send the .aia file to me after doing the program and thank you again
GPA_Cal.aia

Scott Ferguson

unread,
Sep 23, 2015, 12:41:52 AM9/23/15
to mitappinv...@googlegroups.com
It looks as if you have a good idea how it works.
Rather than me coding it for you, why don't you try doing it on your own then if it doesn't work, come back here with some screen shots of what you tried?
---
sf
Message has been deleted

ALI Alshabe

unread,
Sep 24, 2015, 2:44:38 AM9/24/15
to mitappinv...@googlegroups.com

I have to find a new way, but there is a problem in my way when I press a calculation  button he result to me the answer but divider on 2 That means if the answer is 20, shows 10 Can you solve it


GPA_Cal.aia

Abraham Getzler

unread,
Sep 24, 2015, 2:30:25 PM9/24/15
to MIT App Inventor Forum
I'm not sure you have the same understanding of what a GPA is compared
to our understanding.

GPAs (as I know them) only run from 0 to 4 or 5.
They could never be 10 or 20.

But you say it should be 20?


ALI Alshabe

unread,
Sep 25, 2015, 1:59:47 AM9/25/15
to mitappinv...@googlegroups.com
 yes i have make a mistake but i have fix my program and he is ready to Launch i need you to test my program to see if i understanding the gpa very will


Sorry, the apk GPA_Cal was removed by the Moderators.  Users are not permitted to post apk files in this forum as a security issue.   You may post aia files and screen capture png or jpg images of your blocks.

Scott Ferguson

unread,
Sep 25, 2015, 2:02:00 PM9/25/15
to MIT App Inventor Forum
As Abraham said, you are not calculating the GPA correctly.
You are dividing by the number of courses, but should be dividing by the number of hours attempted.

To calculate the GPA, multiply each course's letter grade value by it's number of hours, sum that value, then divide by the total number of attempted hours (not the number of courses)

Here is how the GPA for the example below was calculated:

the GPA of 2.15625 = (1 x 2.25 + 3 x 3 + 3 x 1.5 + 1 x 1.5) / (1 + 3 + 3 + 1)



Here are your blocks to calculate the GPA for 4 courses before being corrected:


Here are the corrected blocks to get my test example to work:
Note the outlined changes that were made. Repeat these changes as required for all other cases.


Good luck with your project and Happy Inventing!
---
sf
GPA_Cal_2.aia

ALI Alshabe

unread,
Sep 26, 2015, 9:24:46 AM9/26/15
to MIT App Inventor Forum
thank you sf for help
Reply all
Reply to author
Forward
0 new messages