private void PrintStudents(Dictionary <string, double> studentsSorted)
 {
     foreach (var kvp in studentsSorted)
     {
         OutputWriter.PrintStudent(kvp);
     }
 }
Пример #2
0
 public void GetStudentScoresFromCourse(string student, string course)
 {
     if (IsQueryForStudentPossible(course, student))
     {
         OutputWriter.PrintStudent(new KeyValuePair <string, double>(student, this.courses[course].StudentsByName[student].MarksByCourseName[course]));
     }
 }
Пример #3
0
 public static void PrintStudents(Dictionary <string, double> studentsSorted)
 {
     foreach (var kv in studentsSorted)
     {
         OutputWriter.PrintStudent(kv);
     }
 }
Пример #4
0
 public void PrintStudent(Dictionary <string, double> studentsSorted)
 {
     foreach (var pair in studentsSorted)
     {
         OutputWriter.PrintStudent(pair);
     }
 }
Пример #5
0
 public void GetStudentMarkInCourse(string courseName, string username)
 {
     if (IsQueryForStudentPossible(courseName, username))
     {
         OutputWriter.PrintStudent(new KeyValuePair <string, double>(username, this.courses[courseName].StudentsByName[username].MarksByCourseName[courseName]));
     }
 }
Пример #6
0
 public static void GetStudentScoresFromCourse(string courseName, string userName)
 {
     if (IsQueryForStudentPossiblе(courseName, userName))
     {
         OutputWriter.PrintStudent(new KeyValuePair <string, List <int> >(userName, studentsByCourse[courseName][userName]));
     }
 }
Пример #7
0
 private static void PrintStudents(Dictionary <string, List <int> > studentsSorted)
 {
     foreach (var kvp in studentsSorted)
     {
         OutputWriter.PrintStudent(kvp);
     }
 }
 private static void PrintStudents(Dictionary <string, List <int> > studentsSorted)
 {
     foreach (KeyValuePair <string, List <int> > keyValuePair in studentsSorted)
     {
         OutputWriter.PrintStudent(keyValuePair);
     }
 }
 public static void PrintStudent(Dictionary <string, List <int> > studentsSorted)
 {
     foreach (var pair in studentsSorted)
     {
         OutputWriter.PrintStudent(pair);
     }
 }
Пример #10
0
 public static void GetStudentScoresFromCourse(string courseName, string username)
 {
     if (studentsByCourse.ContainsKey(courseName) && studentsByCourse[courseName].ContainsKey(username))
     {
         OutputWriter.PrintStudent(new KeyValuePair <string, List <int> >(username, studentsByCourse[courseName][username]));
     }
 }
Пример #11
0
 private void PrintStudents(Dictionary <string, double> studentsSorted)
 {
     foreach (KeyValuePair <string, double> keyValuePair in studentsSorted)
     {
         OutputWriter.PrintStudent(keyValuePair);
     }
 }
Пример #12
0
 public static void GetStudentScoresFromCourse(string course, string student)
 {
     if (IsQueryForStudentPossible(course, student))
     {
         OutputWriter.PrintStudent(new KeyValuePair <string, List <int> >(student, studentsByCourse[course][student]));
     }
 }
 private void PrintStudents(Dictionary <string, double> sortedStudents)
 {
     foreach (var student in sortedStudents)
     {
         OutputWriter.PrintStudent(student);
     }
 }
Пример #14
0
 public void GetStudentScoresFromCourse(string courseName, string username)
 {
     OutputWriter.PrintStudent(
         new KeyValuePair <string, double>(username,
                                           this.courses[courseName]
                                           .StudentsByName[username]
                                           .MarksByCourseName[courseName]));
 }
Пример #15
0
        private static void OrderAndTake(Dictionary <string, List <int> > wantedData, int studentsToTake, Func <KeyValuePair <string, List <int> >, KeyValuePair <string, List <int> >, int> comparisonFunc)
        {
            Dictionary <string, List <int> > studentsSorted = GetSortedStudents(wantedData, studentsToTake, comparisonFunc);

            foreach (var stud in studentsSorted)
            {
                OutputWriter.PrintStudent(stud);
            }
        }
Пример #16
0
        private void PrintStudents(Dictionary <string, double> studentsWithMarks)
        {
            var counterForPrinted = 0;

            foreach (var student in studentsWithMarks)
            {
                OutputWriter.PrintStudent(new KeyValuePair <string, double>(student.Key, student.Value));
                counterForPrinted++;
            }
        }
Пример #17
0
 public static void GetAllStudentFromCourse(string courseName)
 {
     if (isQueryForCoursePossible(courseName))
     {
         OutputWriter.WriteMessegesOnNewLine($"{courseName}");
         foreach (var item in studentsByCourse[courseName])
         {
             OutputWriter.PrintStudent(item);
         }
     }
 }
 public static void GetAllStudentsFromCourse(string courseName)
 {
     if (IsQueryForCoursePossible(courseName))
     {
         OutputWriter.WriteMessageOnNewLine($"{courseName}:");
         foreach (var studentMarksEntry in studentsByCourse[courseName])
         {
             OutputWriter.PrintStudent(studentMarksEntry);
         }
     }
 }
Пример #19
0
        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.PrintStudent(new KeyValuePair <string, double>(studentMark.Key, studentMark.Value));
                    counterForPrinted++;
                }
            }
        }
        private void FilterAndTake(Dictionary <string, double> studentsWithGrades,
                                   Predicate <double> givenFilter, int studentsToTake)
        {
            var printedStudents = 0;

            foreach (var student in studentsWithGrades)
            {
                if (printedStudents == studentsToTake)
                {
                    break;
                }
                if (givenFilter(student.Value))
                {
                    OutputWriter.PrintStudent(new KeyValuePair <string, double>(student.Key, student.Value));
                    printedStudents++;
                }
            }
        }
Пример #21
0
        private void FilterAndTake(Dictionary <string, double> studentsWithMarks, Predicate <double> givenFilter, int studentsToTake)
        {
            int counter = 0;

            foreach (var username_score in studentsWithMarks)
            {
                if (counter == studentsToTake)
                {
                    break;
                }

                if (givenFilter(username_score.Value))
                {
                    OutputWriter.PrintStudent(username_score);
                    counter++;
                }
            }
        }
Пример #22
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 percentageOfFullfillments = averageScore / 100;
                double mark = percentageOfFullfillments * 4 + 2;
                if (givenFilter(mark))
                {
                    OutputWriter.PrintStudent(userName_Points);
                    counterForPrinted++;
                }
            }
        }
Пример #23
0
        private static void FilterAndTake(Dictionary <string, List <int> > wantedData, Predicate <double> givenFilter,
                                          int studentsToTake)
        {
            int counterForPrinted = 0;

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

                double averageMark = Average(usernamePoints.Value);
                if (givenFilter(averageMark))
                {
                    OutputWriter.PrintStudent(usernamePoints);
                    counterForPrinted++;
                }
            }
        }
Пример #24
0
        public static void FilterAndTake(Dictionary <string, List <int> > wantedData, Predicate <double> givenFilter,
                                         int studentsToTake)
        {
            int counterForPrinted = 0;

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

                double averageMark = usernamePoint.Value.Average();
                double percentage  = averageMark / 100;
                double mark        = percentage * 4 + 2;
                if (givenFilter(mark))
                {
                    OutputWriter.PrintStudent(usernamePoint);
                    counterForPrinted++;
                }
            }
        }
Пример #25
0
        private static void FilterAndTake(Dictionary <string, List <int> > wantedData, Predicate <double> givenFilter, int studentsToTake)
        {
            int counter = 0;

            foreach (var username_score in wantedData)
            {
                if (counter == studentsToTake)
                {
                    break;
                }

                var avrScore = username_score.Value.Average();
                var percentageOfFullfillments = avrScore / 100;
                var mark = percentageOfFullfillments * 4 + 2;

                if (givenFilter(mark))
                {
                    OutputWriter.PrintStudent(username_score);
                    counter++;
                }
            }
        }
Пример #26
0
        private static void FilterAndTake(Dictionary <string, List <int> > wantedData, Predicate <double> givenFilter, int studentsToTake)
        {
            int filteredMarksCount = 0;

            foreach (KeyValuePair <string, List <int> > usernamePoints in wantedData)
            {
                if (filteredMarksCount == studentsToTake)
                {
                    break;
                }

                double averageMark    = usernamePoints.Value.Average();
                double percentOfTotal = averageMark / 100;
                double mark           = percentOfTotal * 4 + 2;

                if (givenFilter(mark))
                {
                    OutputWriter.PrintStudent(usernamePoints);
                    filteredMarksCount++;
                }
            }
        }
        /// <summary>
        /// Method which will actually do the filtration
        /// </summary>
        /// <param name="wantedData">Dictionary that corresponds to the students with their scores from the seeked course.</param>
        /// <param name="givenFilter">Filter to use.</param>
        /// <param name="studentsToTake">The number of students to take.</param>
        private static void FilterAndTake(Dictionary <string, List <int> > wantedData, Predicate <double> givenFilter,
                                          int studentsToTake)
        {
            int counterForPrinted = 0;

            foreach (var userMarksKVP in wantedData)
            {
                double averageScore    = userMarksKVP.Value.Average();
                var    percentageOfAll = averageScore / 100;
                var    mark            = percentageOfAll * 4 + 2;

                if (givenFilter(mark))
                {
                    OutputWriter.PrintStudent(userMarksKVP);
                    counterForPrinted++;
                }

                if (counterForPrinted == studentsToTake)
                {
                    break;
                }
            }
        }