tags:

views:

70

answers:

2

I'm looking for a PHP class or script that i can use the calculate a students GPA from a Grade point scale.

Example: http://www.williams.edu/registrar/records/gpa.html

Also, need to take into account Honor and AP classes. (If class is chosen as honors assign additional .5 points to letter grade. If chosen as AP or IB assign 1 additional point to letter grade)


It's not hard to re-create one myself, i'm just looking for something already pre-made i can use to save me some time.

+1  A: 
  1. Get a list of weightings per grade e.g (A-4,B-3,C-2 etc).
  2. Sum the weightings for each grade.
  3. Divide by total number of grades/courses.
filip-fku
+1  A: 
$score_arr = array(4.0, 3.2, 2.2);

function getGPA($score_arr) {
     $count = count($score_arr);
     $sum = array_sum($score_arr);

     $gpa = $sum / $count;

     return $gpa;

}

Add: Could be modified to accept letter grades, compare via the chart, and sum scores appropriately. The details were missing when I began the post.

bpeterson76
What if classes are weighed differently? My classes are a mix of everything from 1 to 5 credits.
Brendan Long
@Brendan - `(($score*$credits) + ($scoreb*$creditsb) + ...) / $totalcredits;`
thetaiko