GPA funtion

Hi I am trying to come up with a function that will calculate GPA. Right now i am using if else statements. But am having trouble writing "o 64% and 63% are a 0.9
o 62% and 61% are a 0.8"



95% and above 4.0
 for each percentage from 94% down to 65%, drop the grade point by 0.1 - here are some examples
o 94% - 3.9
o 90% - 3.5
o 82% - 2.7
o 65% - 1.0
o 64% and 63% are a 0.9
o 62% and 61% are a 0.8
o 60% is a 0.7
o below 60% is a 0.0

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
float calcGrade(double assignsPerc, double quizzesPerc, double examsPerc, double finalPerc)
{
    double grade, grade1, grade2, grade3, grade4, overallGrade, x, sum1, sum;
    grade1 = (assignsPerc * 0.40); grade2 = (quizzesPerc * 0.10);
    grade3 = (examsPerc * 0.25); grade4 = (finalPerc * 0.25);
    overallGrade = (grade1 + grade2 + grade3 + grade4);
        if (overallGrade >= 95)
        {
            grade = 4.0;
        }
        else
        {
            sum = 95 - overallGrade;
            sum1 = sum/10;
            grade = 4.0 - sum1;
        }
        if(overallGrade < 60)
        {
            grade = 0.0;
        }
    return grade;
Topic archived. No new replies allowed.