示例#1
0
 private static void PrintStudents(Dictionary <string, List <int> > studentsSorted)
 {
     foreach (KeyValuePair <string, List <int> > student in studentsSorted)
     {
         OutputWriter.DisplayStudent(student);
     }
 }
示例#2
0
 public static void GetStudentScoresFromCourse(string courseName, string studentName)
 {
     if (IsQueryForStudentPossiblе(courseName, studentName))
     {
         OutputWriter.DisplayStudent(new KeyValuePair <string, List <int> >(studentName, studentsByCourse[courseName][studentName]));
     }
 }
 public void GetStudentScoreFromCourse(string username, string courseName)
 {
     if (IsQueryForStudentPossiblе(courseName, username))
     {
         OutputWriter.DisplayStudent(new KeyValuePair <string, double>(username, this.courses[courseName].StudentByName[username].MarksByCourseName[courseName]));
     }
 }
 // Private void method, for printing the sorted dictionary of students, which is used only in the current class
 private void PrintStudents(Dictionary <string, double> studentsSorted)
 {
     foreach (KeyValuePair <string, double> keyValuePair in studentsSorted)
     {
         OutputWriter.DisplayStudent(keyValuePair);
     }
 }
 // Method for calculating the score of a certain student in a course and printing the student himself
 public void GetStudentMarkInCourse(string courseName, string studentName)
 {
     if (IsQueryForStudentPossible(courseName, studentName))
     {
         OutputWriter.DisplayStudent
             (new KeyValuePair <string, double>(studentName, this.courses[courseName].StudentsByName[studentName].MarksByCourseName[courseName]));
     }
 }
示例#6
0
 public static void GetAllStudentsFromCourse(string courseName)
 {
     if (IsQueryForCoursePossible(courseName))
     {
         OutputWriter.WriteMessageOnNewLine($"{courseName}:");
         foreach (var studentsMarksEntry in studentsByCourse[courseName])
         {
             OutputWriter.DisplayStudent(studentsMarksEntry);
         }
     }
 }
示例#7
0
        // Private void method doing some work only for the current class
        private void FilterAndTake(Dictionary <string, double> studentsWithMarks, Predicate <double> givenFilter,
                                   int studentsToTake)
        {
            int counterForPrinted = 0;

            foreach (var studentMark in studentsWithMarks)
            {
                if (counterForPrinted == studentsToTake)
                {
                    break;
                }

                if (givenFilter(studentMark.Value))
                {
                    OutputWriter.DisplayStudent(new KeyValuePair <string, double>(studentMark.Key, studentMark.Value));
                    counterForPrinted++;
                }
            }
        }
示例#8
0
        private static void FilterAndTake(Dictionary <string, List <int> > wantedData, Predicate <double> givenFilter,
                                          int studentsToTake)
        {
            int counterForPrinted = 0;

            foreach (var userName_Points in wantedData)
            {
                if (counterForPrinted == studentsToTake)
                {
                    break;
                }

                double averageScore           = userName_Points.Value.Average();
                double percetageOfFullfilment = averageScore / 100d;
                double mark = percetageOfFullfilment * 4 + 2;
                if (givenFilter(mark))
                {
                    OutputWriter.DisplayStudent(userName_Points);
                    counterForPrinted++;
                }
            }
        }