static void Main(string[] args) { StudentCollection st = new StudentCollection(); st.AddDefaults(); Student s1 = new Student(new Person("Leonardo", "Da Vinci", new DateTime(1452, 4, 15)), Enducation.Specialist, 556); s1.AddExams(new Exam("Drawings", 5, new DateTime(1464, 6, 5)), new Exam("Design", 4, new DateTime(1966, 8, 15))); s1.AddTests(new Test("Design", true)); Student s2 = new Student(new Person("Leonardo", "DiCaprio", new DateTime(1974, 11, 11)), Enducation.Bachelor, 451); s2.AddExams(new Exam("Listening", 3, new DateTime(1980, 6, 25))); s2.AddTests(new Test("Reading", true)); st.AddStudents(s1, s2); Console.WriteLine("Unsorted: \n" + st.ToShortString()); st.SortBySurname(); Console.WriteLine("Sort By Surname: \n" + st.ToShortString()); st.SortByDate(); Console.WriteLine("Sort By Date: \n" + st.ToShortString()); st.SortByAverage(); Console.WriteLine("Sort By Average: \n" + st.ToShortString()); Console.WriteLine("Max Average Mark: " + st.MaxAverageMark); Console.WriteLine("\nOnly Specialists: "); foreach (Student student in st.GetSpecialist) { Console.WriteLine(student.ToShortString()); } //TODO Wtf group by? Console.WriteLine("\nAverage Mark Group: "); foreach (Student student in st.AverageMarkGroup(4.75)) { Console.WriteLine(student.ToShortString()); } int input = 0; while (true) { try { input = int.Parse(Console.ReadLine()); break; } catch (Exception ex) { Console.WriteLine(ex.Message); continue; } } TestCollections tc = new TestCollections(input); tc.SearchTime(); Console.ReadKey(); }
static void Main(string[] args) { StudentCollection Stud = new StudentCollection(); Student stud1 = new Student(); stud1._DateStudent = new Person("Test", "Student", new DateTime(1997, 11, 11)); stud1._Education = Education.SecondEducation; stud1._NamberGrup = 402; Examp Ex1 = new Examp("Math", 3, new DateTime(2017, 12, 11)); Examp Ex2 = new Examp("Programing", 5, new DateTime(2017, 12, 24)); Test Ts1 = new Test("Art", true); Test Ts2 = new Test("Music", true); Test Ts3 = new Test("Science", false); stud1._InformatoinExamp.Add(Ex1); stud1._InformatoinExamp.Add(Ex2); stud1._InformationTest.Add(Ts1); stud1._InformationTest.Add(Ts2); stud1._InformationTest.Add(Ts3); Stud.AddStudent(stud1); stud1 = new Student(); stud1._DateStudent = new Person("Roma", "Baglay", new DateTime(2010, 6, 10)); stud1._Education = Education.Baxhelor; stud1._NamberGrup = 402; Ex1 = new Examp("Math", 5, new DateTime(2017, 12, 11)); Ex2 = new Examp("Programing", 5, new DateTime(2017, 12, 24)); Ts1 = new Test("Art", true); Ts2 = new Test("Music", true); Ts3 = new Test("Science", false); stud1._InformatoinExamp.Add(Ex1); stud1._InformatoinExamp.Add(Ex2); stud1._InformationTest.Add(Ts1); stud1._InformationTest.Add(Ts2); stud1._InformationTest.Add(Ts3); Stud.AddStudent(stud1); stud1 = new Student(); stud1._DateStudent = new Person("Misha", "Fasolya", new DateTime(1996, 11, 27)); stud1._Education = Education.Master; stud1._NamberGrup = 402; Ex1 = new Examp("Math", 3, new DateTime(2017, 12, 11)); Ex2 = new Examp("Programing", 3, new DateTime(2017, 12, 24)); Ts1 = new Test("Art", true); Ts2 = new Test("Music", true); Ts3 = new Test("Science", false); stud1._InformatoinExamp.Add(Ex1); stud1._InformatoinExamp.Add(Ex2); stud1._InformationTest.Add(Ts1); stud1._InformationTest.Add(Ts2); stud1._InformationTest.Add(Ts3); Console.WriteLine("------------------------------------------ StudentColections"); Stud.AddStudent(stud1); Console.WriteLine(Stud.ToString()); Console.WriteLine("------------------------------------------ SortName"); Stud.SortName(); Console.WriteLine(Stud.ToString()); Console.WriteLine("------------------------------------------ SortDate"); Stud.SortDate(); Console.WriteLine(Stud.ToString()); Console.WriteLine("------------------------------------------ SortEverage"); Stud.SortEverage(); Console.WriteLine(Stud.ToString()); Console.WriteLine("------------------------------------------ LINQInquiries"); Console.WriteLine("---------- MaxAverageStudent"); Console.WriteLine("Max:{0}", Stud.ReadEvarageMax); Console.WriteLine("---------- Education.Master"); foreach (var str in Stud.EducationMaster) { Console.WriteLine(str + "\n---------------------"); } Console.WriteLine("----------> GroupingStudentAverage"); foreach (var str in Stud.AverageMarkGroup(5)) { Console.WriteLine(str + "\n---------------------"); } Console.WriteLine("------------------------------------------ SearchCollections"); Console.ReadLine(); }