To convert the midterm and final to a score in that range, I use the following routine:
double A = 90.0;
double B = 80.0;
double C = 70.0;
double D = 60;
double test_convert(double score, double top, double a,
double b, double c, double d)
{
if (score >= a) {
return (score - a)/(top - a) * (100.0-A) + A;
} else if (score >= b) {
return (score - b)/(a - b) * (A-B) + B;
} else if (score >= c) {
return (score - c)/(b - c) * (B-C) + C;
} else if (score >= d) {
return (score - d)/(c - d) * (C-D) + D;
} else {
return (score)/d * (D);
}
} |
The midterm scores are converted with:
score = test_convert(tmp2->val.d, 34, 29, 22, 15, 13);and the final scores are convered with:
score = test_convert(tmp2->val.d, 41, 32, 25, 21, 16);
I counted the midterm and final 25% each, and the labs 50%.
Final tally: 4 A+s, 8 A's, 4 B+'s, 3 B's, 3 C+'s 2 C's, 3 D's, 2 F's.