コード例 #1
0
        static void Main()
        {
            var someSchool = new School();
            var eveningClass = new Class("Level#2");
            var trainer = new Teacher("Mr. NakMan");
            var disciplineClassA = new Discipline("OOP", 2, 2);

            var firstStudent = new Student("Anamalech", 1);
            var thirdStudent = new Student("Corson", 3);
            var secondStudent = new Student("Boruta", 2);
            var forthStudent = new Student("Lucifer", 4);

            //Okay. Let's summon the demons... pardon, Demos!
            someSchool.AddClass(eveningClass);
            eveningClass.AddTeacher(trainer);
            trainer.AddDiscipline(disciplineClassA);

            eveningClass.AddStudent(firstStudent);
            eveningClass.AddStudent(secondStudent);
            eveningClass.AddStudent(thirdStudent);
            eveningClass.AddStudent(forthStudent);

            Console.WriteLine(eveningClass.ToString());
            Console.WriteLine();
        }
コード例 #2
0
        static void Main()
        {
            // Student jack = new Student("Jack", "123456"); // should throw an exception - classNumber is not unique
            Student monica = new Student("Monica", "100096", "excellent student");
            Student ross = new Student("Ross", "100097", "very interested in history");
            Student joey = new Student("Joey", "100098", "takes acting classes");
            Student phoebe = new Student("Phoebe", "100099", "takes music classes");
            Student chandler = new Student("Chandler", "100100", "makes inappropriate jokes all the time");
            Student rachel = new Student("Rachel", "100101", "very interested in fashion");
            Student gunther = new Student("John", "1000102", "blonde");

            Discipline history = new Discipline("History", 40,
                new List<Student> { monica, ross, joey, phoebe, chandler, rachel, gunther }, "mandatory");
            Discipline music = new Discipline("Music", 15, new List<Student> { joey, phoebe, ross }, "optional");
            Discipline acting = new Discipline("Acting", 10, new List<Student> { joey, phoebe, gunther, monica }, "optional");
            Discipline literature = new Discipline("Literature", 40,
                new List<Student> { monica, ross, joey, phoebe, chandler, rachel, gunther }, "mandatory");

            Teacher geller = new Teacher("Geller", new List<Discipline> { history, literature });
            Teacher buffay = new Teacher("Buffay", new List<Discipline> { music, acting });

            SchoolClass testClass = new SchoolClass("Friends", new List<Teacher> { geller, buffay },
                new List<Student> { monica, ross, joey, phoebe, chandler, rachel, gunther }, "excellent class");
        }
コード例 #3
0
        public static void Main()
        {
            Student pesho = new Student("Pesho", "201411V21", "very tallented, self-critical");
            Student misho = new Student("Misho", "201411V13");

            // Student gatyo = new Student("Gosho", "201411V13"); // should throw exception
            Student gosho = new Student("Gosho", "201412V13");
            Student katya = new Student("Katya", "201412V19", "likes litterature, expecially indian novels of Karl May");

            Discipline maths = new Discipline("Mathematics", new List<Student>() { pesho, gosho, misho }, 35);
            Discipline litterature = new Discipline("Litterature", new List<Student>() { gosho, misho, katya }, 15, "optional");
            Discipline informatics = new Discipline("Informatics", new List<Student>() { pesho, gosho, katya, misho }, 50, "main discipline");

            Teacher peshova = new Teacher("Peshova", new List<Discipline>() { litterature });
            Teacher dushkov = new Teacher("Dushkov", new List<Discipline>() { maths, informatics });

            SchoolClass class201411V = new SchoolClass("201411V", new List<Student>() { pesho, misho }, new List<Teacher>() { peshova });

            // below row should throw exception
            // SchoolClass class201412 = new SchoolClass("201411V", new List<Student>() { }, new List<Teacher>() { peshova, dushkov });
            SchoolClass class201412V = new SchoolClass("201412V", new List<Student>() { }, new List<Teacher>() { peshova, dushkov });

            School eg = new School(new List<SchoolClass>() { class201411V, class201412V });
        }
コード例 #4
0
 public void AddTeacher(Teacher teacher)
 {
     this.Teachers.Add(teacher);
 }