Exemple #1
0
        static void Main(string[] args)
        {
            Person pnew = new Person("Александр", "Димов", new DateTime(1996, 3, 20));
            Student s1 = new Student(pnew, Education.Specialist, 123);

            Console.WriteLine(s1.ToShortString());

            Exam e1 = new Exam();
            Exam e2 = new Exam("Матан", 3, new DateTime(2016, 1, 30, 10, 0, 0));
            Exam e3 = new Exam("ССПД", 4, new DateTime(2016, 1, 16, 8, 5, 0));
            s1.AddExams(e1, e2, e3);

            Test t1 = new Test();
            Test t2 = new Test("Социология", true);
            s1.AddTests(t1, t2);

            Console.WriteLine(s1.ToString());

            Person p1 = new Person("Станислав", "Одинцов", new DateTime(1990, 5, 13));
            Person p2 = new Person("Станислав", "Одинцов", new DateTime(1990, 5, 13));
            Console.WriteLine(p1.GetHashCode() + " | " + p2.GetHashCode());

            Console.WriteLine(s1.info);

            Student s2 = s1.DeepCopy() as Student;
            s1.gsGroup = 100;

            Console.WriteLine("\n" + s1.ToShortString() + "\n");
            Console.WriteLine(s2.ToShortString());

            try
            {
                s1.gsGroup = 100;
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine("\n--Экзамены на 4 и 5--");
            foreach (Object obj in s1.examList)
            {
                if ((obj as Exam).grade > 3)
                    Console.WriteLine(obj.ToString());
            }
        }
Exemple #2
0
        public void AddExams(params Exam[] ex)
        {
            Exam[] newExamList = new Exam[exams.Length + ex.Length];

            for (int i = 0; i < exams.Length; i++)
                newExamList[i] = exams[i];

            for (int i = exams.Length; i < exams.Length + ex.Length; i++)
                newExamList[i] = ex[i];

            exams = newExamList;
        }