Calculating course grades

Course grades are calculated according to a standard formula, as follows:

If the course has only one module which is graded A to F, the final grade on the course is going to be the same as on the graded module. If there are multiple modules with grading A to F, the average of the grades is produced by translating letters into numbers according to A = 4, B = 3, C = 2, D = 1, E = 0. The average is calculated relative to the number of credits of the various modules. Then 0.34 is added, and the amount you get will be rounded down.

Example: A course has two graded modules of 2.5 credits each. A student gets A on the first module and B on the second module. A = 4 + B = 3 gives 7, 7/2 = 3.5, then 0.34 is added yielding 3.84 which is then rounded down: result 3. Giving a final course grade B.

Example: A course has two graded modules of 5 credits and 2.5 credits. A student gets a C on the 5 credit module and an A on the 2.5 credit module. C = 2 * 5 + A = 4 * 2.5 becomes 20 divided by 7.5 is 2.67. Then 0.34 is  added, yielding 3.01 rounded down to 3. The final course grade is B.