Example #1
0
        //01. We are given a school. In the school there are
        //classes of students. Each class has a set of teachers.
        //Each teacher teaches a set of disciplines. Students have
        //name and unique class number. Classes have unique text identifier.
        //Teachers have name. Disciplines have name, number of lectures and
        //number of exercises. Both teachers and students are people. Students,
        //classes, teachers and disciplines could have optional comments (free text block).

        //Your task is to identify the classes (in terms of  OOP) and their attributes
        //and operations, encapsulate their fields, define the class hierarchy and create
        //a class diagram with Visual Studio.

        static void Main()
        {
            School PMG = new School("PMG");

            ClassOfStudents _11a = new ClassOfStudents("11 A");

            Student pesho = new Student("Pesho", 1);
            Student gosho = new Student("Gosho", 2);

            _11a.AddStudent(pesho);
            _11a.AddStudent(gosho);

            Discipline math    = new Discipline("Mathematics", 5, 10);
            Discipline physics = new Discipline("Physics", 5, 15);

            Teacher rangelova = new Teacher("Rangelova");

            rangelova.AddComment("Az imam kozi");
            rangelova.AddDiscipline(math);
            rangelova.AddDiscipline(physics);

            _11a.AddStudent(pesho);
            _11a.AddStudent(gosho);
            _11a.AddTeacher(rangelova);

            PMG.AddClass(_11a);
        }
Example #2
0
        static void Main(string[] args)
        {
            School someSchool = new School("Ivan Vazov");

            ClassOfStudents _8b = new ClassOfStudents("8 B");

            Students ivan  = new Students("Ivan", 10);
            Students mitko = new Students("Mitko", 15);
            Students petko = new Students("Petko", 20);

            _8b.AddStudent(ivan);
            _8b.AddStudent(mitko);
            _8b.AddStudent(petko);

            ivan.AddComment("Iskam 6 !");


            Disciplines literature = new Disciplines("Literature", 20, 10);
            Disciplines journalism = new Disciplines("Journalism", 30, 40);


            Teachers vuchkov = new Teachers("Profesor Vuchkov");

            vuchkov.AddComment("Gledam i ne vqrvam na ushite si !");
            vuchkov.AddDiscipline(literature);
            vuchkov.AddDiscipline(journalism);

            _8b.AddTeacher(vuchkov);

            someSchool.AddClass(_8b);

            Console.WriteLine("Class number of {0} is : {1}", petko.Name, petko.ClassNumber);

            foreach (var item in vuchkov.OptionalComments)
            {
                Console.WriteLine("Professor Vuchkov declared : {0}", item);
            }

            Console.WriteLine();
            Console.WriteLine("He teaches the following disciplines : ");
            foreach (var item in vuchkov.Disciplines)
            {
                Console.WriteLine(item.NameOfLecture);
            }
        }