static void Main(string[] args) { Person person1 = new Person("Serhiy", "Pityk", new DateTime(2000, 3, 27)); Person person2 = new Person("Serhiy", "Pityk", new DateTime(2000, 3, 27)); if (person1.Equals(person2)) { Console.WriteLine("Objects are equals"); } else { Console.WriteLine("Oblects are not equals"); } Console.WriteLine(person1.GetHashCode()); Console.WriteLine(person2.GetHashCode()); Student student = new Student(person1, Education.Bachelor, 312); System.Collections.ArrayList tests = new System.Collections.ArrayList(); tests.Add(new Test("Math", true)); tests.Add(new Test("English", true)); tests.Add(new Test("Programming", true)); student.Testss = tests; System.Collections.ArrayList exams = new System.Collections.ArrayList(); exams.Add(new Exam("NETCore", 90, new DateTime(2020, 4, 13))); exams.Add(new Exam("JavaCore", 95, new DateTime(2020, 4, 10))); exams.Add(new Exam("PHP", 70, new DateTime(2020, 4, 5))); student.Examss = exams; Console.WriteLine(student.ToString()); Console.WriteLine(student.Info.GetName()); Console.WriteLine(student.Info.GetSurname()); Console.WriteLine(student.Info.GetBirthDate().ToString()); Student studentCopy = (Student)student.DeepCopy(); student.SetName("Artem"); student.SetSurname("Shtefanesa"); student.SetBirthDate(new DateTime(1999, 2, 10)); if (student == studentCopy) { Console.WriteLine("Something went wrong"); } else { Console.WriteLine("Objects arent equals"); } try { student.GroupNumberr = 50; } catch (Exception ex) { Console.WriteLine(ex.Message); } foreach (Exam exam in student.GetEnumeratorMoreThan(80)) { Console.WriteLine(exam.Mark); } }
static void Main(string[] args) { Person person1 = new Person("Les", "Podervlansky", new DateTime(1998, 1, 2)); Person person2 = new Person("Les", "Podervlansky", new DateTime(1998, 1, 2)); if (person1.Equals(person2)) { Console.WriteLine("Are equal."); } else { Console.WriteLine("Are not equal."); } Console.WriteLine(person1.GetHashCode()); Console.WriteLine(person2.GetHashCode()); Student student = new Student(person1, Education.Bachelor, 302); System.Collections.ArrayList tests = new System.Collections.ArrayList(); tests.Add(new Test("Calculus", true)); tests.Add(new Test("Differential Equations", true)); tests.Add(new Test("Algebra", true)); student.Testss = tests; System.Collections.ArrayList exams = new System.Collections.ArrayList(); exams.Add(new Exam("JavaScript", 77, new DateTime(2020, 1, 31))); exams.Add(new Exam("Web-Design", 95, new DateTime(2020, 1, 28))); exams.Add(new Exam("Economics", 81, new DateTime(2020, 1, 25))); student.Examss = exams; Console.WriteLine(student.ToString()); Console.WriteLine(student.Info.FirstName); Console.WriteLine(student.Info.Surname); Console.WriteLine(student.Info.DateOfBirth.ToString()); Student studentCopy = (Student)student.DeepCopy(); student.FirstName = "Les"; student.Surname = "Claypool"; student.DateOfBirth = new DateTime(1996, 1, 2); if (student == studentCopy) { Console.WriteLine("Error occured"); } else { Console.WriteLine("Are not equal."); } try { student.GroupNumber = 30; } catch (Exception ex) { Console.WriteLine(ex.Message); } foreach (Exam exam in student.GetEnumeratorMoreThan(80)) { Console.WriteLine(exam.Mark); } }