using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _09._02._2019 { class Program { class Student { public double ExamPercent { get; private set; } // 0.0−1.0 public double AttendancePercent { get; private set; } // 0.0−1.0 public Student(double examPercent, double attendancePercent) { if (examPercent > 1.0 || attendancePercent > 1.0) throw new ArgumentOutOfRangeException(); if (examPercent < 0.0 || attendancePercent < 0.0) throw new ArgumentOutOfRangeException(); ExamPercent = examPercent; AttendancePercent = attendancePercent; } } interface IGrader { List CreateNewStudentList(List student); double CalculateAverage(List student); } class FeritGrader : IGrader { public double MinScore { get; private set; } public double MinAttendance { get; private set; } public FeritGrader(double minScore, double minAttendance) { //Kontrola granicnih vrijednosti je obavljena, ali izostavljena radi prostora MinScore = minScore; MinAttendance = minAttendance; } public List CreateNewStudentList(List student) { List newStudentList = new List(); for (int i = 0; i < student.Count(); i++) { if(student[i].ExamPercent > MinScore && student[i].AttendancePercent > MinAttendance) { newStudentList.Add(true); } else { newStudentList.Add(false); } } return newStudentList; } public double CalculateAverage(List student) { double sum = 0; int counter = 0; for (int i = 0; i < student.Count(); i++) { if (student[i].ExamPercent > MinScore && student[i].AttendancePercent > MinAttendance) { sum = student[i].ExamPercent; counter++; } } return sum / counter; } } void RemoveStudent(List student) { for(int i = 0; i < student.Count(); i++){ if(student[i].AttendancePercent == 0) { student.RemoveAt(i); } } } static void Main(string[] args) { List students = RetriveStudentsFromISVU(); int totalStudents = students.Count(); RemoveStudent(students); int newTotal = students.Count(); if ((totalStudents - newTotal) > totalStudents / 2){ Console.WriteLine("Studenata kojih nikad nije bilo je manje od pola."); } else { Console.WriteLine("Studenata kojih nikad nije bilo je vise od pola."); } } }