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
文件: Data.cs 项目: valcho62/BashSoft
 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);
     }
 }
 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;
                }
            }
        }