public void GetStudentScoresFromCourse(string courseName, string username)
 {
     if (IsQueryForStudentPossible(courseName, username))
     {
         OutputWriter.PrintStudent(new KeyValuePair <string, double>(username, this.courses[courseName].StudentsByName[username].MarksByCourseName[courseName]));
     }
 }
Example #2
0
 private void PrintStudents(Dictionary <string, double> studentsSorted)
 {
     foreach (KeyValuePair <string, double> keyValuePair in studentsSorted)
     {
         OutputWriter.PrintStudent(keyValuePair);
     }
 }
 public void GetAllStudentsFromCourse(string courseName)
 {
     if (IsQueryForCoursePossible(courseName))
     {
         OutputWriter.WriteMessageOnNewLine($"{courseName}:");
         foreach (var studentMarksEntry in studentsByCourse[courseName])
         {
             OutputWriter.PrintStudent(studentMarksEntry);
         }
     }
 }
Example #4
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++;
                }
            }
        }
Example #5
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;
                }

                //double averageScore = userName_Points.Value.Average();
                //  double percentageOfFullfilment = averageScore / 100;
                //  double mark = percentageOfFullfilment * 4 + 2;

                if (givenFilter(studentMark.Value))
                {
                    OutputWriter.PrintStudent(new KeyValuePair <string, double>(studentMark.Key, studentMark.Value));
                    counterForPrinted++;
                }
            }
        }
        private 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 percentageOfFullfilment = averageScore / 100;
                double mark = percentageOfFullfilment * 4 + 2;

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