Beispiel #1
0
        public static void Main()
        {
            IClass cls = new Class();

            cls.AddStudent(new Student(1, "test01"));
            cls.AddStudent(new Student(2, "test02"));
            cls.AddStudent(new Student(3, "test03"));
            cls.AddStudent(new Student(4, "test04"));
            Console.WriteLine("---------------------------------");
            foreach (var student in cls.Students)
            {
                Console.WriteLine(student);
            }
            Console.WriteLine("---------------------------------");
            cls.Students.Add(new Student(5, "test05"));
            foreach (var student in cls.Students)
            {
                Console.WriteLine(student);
            }
            Console.WriteLine("---------------------------------");
            cls.AddStudent(new Student(5, ""));
            foreach (var student in cls.Students)
            {
                Console.WriteLine(student);
            }
        }
Beispiel #2
0
        public static void Main()
        {
            //students
            Student mariaStudent = new Student("Maria", "Ivanova", 9);

            mariaStudent.Comment = "simple student test";
            Console.WriteLine("Students:");
            Console.WriteLine("{0} {2} is {1}.", mariaStudent, mariaStudent.Comment, mariaStudent.FirstName);

            //teachers
            Teacher vasilenaTeacher = new Teacher("Ivanka", "Vasileva", new Discipline[] { new Discipline("Matemathics"), new Discipline("Physics", 3, 4) });

            vasilenaTeacher.Comment = "simple teacher test";
            Console.WriteLine("\nTeachers:");
            Console.WriteLine("{0} {1} is {2}", vasilenaTeacher, vasilenaTeacher.LastName, vasilenaTeacher.Comment);

            //class
            Class firstClass = new Class("Advance mathematics",
                                         new Teacher[] { vasilenaTeacher, new Teacher("Ivan", "Ivanov", new Discipline[] { new Discipline("Chemistry") }) },
                                         mariaStudent);

            Console.WriteLine("\nClasses:");
            Console.WriteLine(firstClass);

            firstClass.AddStudent(new Student("Vanko", "Belqta", 11));
            firstClass.RemoveTeacher(vasilenaTeacher);

            Console.WriteLine("\n" + firstClass);
        }