internal double CalculateGrade(string courseName) { int[] scores = ScoresByCourse.First(c => c.Key == courseName).Value; double grade = (scores.Average() / 100) * 4 + 2; return(grade); }
internal void SetScoresForCourse(string courseName, int[] newScores) { if (!ScoresByCourse.ContainsKey(courseName)) { throw new StudentNotEnrolledInCourseException(Name, courseName); } else if (newScores.Length > Course.NumberOfTasksPerExam) { throw new InvalidNumberOfScoresException(Name, courseName); } else { int[] oldScores = ScoresByCourse.First(c => c.Key == courseName).Value; for (int s = 0; s < newScores.Length; s++) { if (newScores[s] > oldScores[s]) { oldScores[s] = newScores[s]; } } } }