Calculates Grades