Exemple #1
0
        static void Main(string[] args)
        {
            var student1   = new Student("Ivan Ivanov", 2);
            var student2   = new Student("Pesho Georgiev", 3);
            var student3   = new Student("Stamat Haralampiev", 2);
            var student4   = new Student("Strahil Ivanov", 3);
            var math       = new Disciplines("Mathematics", 10, 24);
            var library    = new Disciplines("Library", 15, 30);
            var csharp     = new Disciplines("CSharp", 20, 40);
            var javascript = new Disciplines("JavaScript", 22, 42);

            var teacher1 = new Teacher("Ginka Petkova", new List <Disciplines> {
                math, library
            });
            var teacher2 = new Teacher("Georgi Georgiev", new List <Disciplines> {
                csharp, javascript
            });
            var class1 = new Class("Class1", new List <Student> {
                student1, student2
            }, new List <Teacher> {
                teacher1, teacher2
            });
            var class2 = new Class("Class2", new List <Student> {
                student3, student4
            }, new List <Teacher> {
                teacher1, teacher2
            });
            var school = new School("Telerik Academy", new List <Class> {
                class1, class2
            });



            class2.AddComment("Important");
            school.AddClass(class1);
            teacher1.AddComment("Hello");
            class1.AddStudent(new Student("Hristo Popov", 4));
            class1.AddTeacher(new Teacher("Stanka Draganova", new List <Disciplines> {
                math, csharp
            }));
            teacher1.AddDiscipline(new Disciplines("Biology", 15, 25));
            math.AddComment("This is very important");
            student1.AddComment("Hello");
            Console.WriteLine(math.ToString());
        }
Exemple #2
0
        static void Main()
        {
            var studentOne   = new Student("Goshko");
            var studentTwo   = new Student("Pencho");
            var studentThree = new Student("Stamat");
            var studentFour  = new Student("Toshko");
            var studentFive  = new Student("Gincho");

            var teacherOne   = new Teacher("Alex");
            var teacherTwo   = new Teacher("Vic");
            var teacherThree = new Teacher("Ste3v");

            var disciplineOne   = new Disciplines("Math", 6, 12);
            var disciplineTwo   = new Disciplines("c#", 8, 16);
            var disciplineThree = new Disciplines("JS", 2, 4);

            teacherOne.AddDiscipline(disciplineOne);
            teacherOne.AddDiscipline(disciplineTwo);

            teacherTwo.AddDiscipline(disciplineTwo);
            teacherOne.AddDiscipline(disciplineThree);
            teacherThree.AddDiscipline(disciplineOne);
            teacherThree.AddDiscipline(disciplineThree);

            var myClass = new Class("The most awesome class");

            myClass.AddStudent(studentOne);
            myClass.AddStudent(studentTwo);
            myClass.AddStudent(studentThree);
            myClass.AddStudent(studentFour);
            myClass.AddStudent(studentFive);
            myClass.AddTeacher(teacherOne);
            myClass.AddTeacher(teacherTwo);
            myClass.AddTeacher(teacherThree);

            var mySchool = new School();

            mySchool.AddClass(myClass);


            Console.WriteLine($"My School has a class: {myClass.TextID}");
            Console.WriteLine("The teachers in the class are:");
            foreach (var teacher in myClass.Teachers)
            {
                Console.WriteLine($"\t{teacher.Name} and he teaches:");
                foreach (var discipline in teacher.Disciplines)
                {
                    Console.WriteLine($"\t\t{discipline.Name} with {discipline.NumExercises} exercises and {discipline.NumLectures} lectures");
                }
            }
            Console.WriteLine("The students in the class are:");
            foreach (var student in myClass.Students)
            {
                Console.WriteLine($"\t{student.Name} with unique ID: {student.ClassNum}");
            }

            studentOne.AddComment("STUDENT ONE COMMENT");
            Console.WriteLine($"Student comment: {string.Join(", ", studentOne.MyComments)}");
            myClass.AddComment("CLASS COMMENT");
            Console.WriteLine($"Class comment: {string.Join(", ", myClass.MyComments)}");
            teacherOne.AddComment("TEACHER ONE COMMENT");
            Console.WriteLine($"Teacher comment: {string.Join(", ", teacherOne.MyComments)}");
            disciplineOne.AddComment("DISCIPLINE ONE COMMENT");
            Console.WriteLine($"Discipline comment: {string.Join(", ", disciplineOne.MyComments)}");
        }