Beispiel #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());
        }
        public static School CreateSchool(string schoolName)
        {
            var school = new School(schoolName);

            var csharp = new Course("C#");
            var oop    = new Course("OOP");
            var html   = new Course("HTML");

            var toshoGoshov = new Teacher("Tosho", "Goshov");
            var goshoPeshov = new Teacher("Gosho", "Peshov");
            var mishoToshov = new Teacher("Misho", "Toshov");

            var csharpDiscipline = new Discipline("C#", 20, 20);
            var oopDiscipline    = new Discipline("OOP", 10, 10);
            var htmlDiscipline   = new Discipline("HTML", 5, 5);

            toshoGoshov.AddDiscipline(csharpDiscipline);
            goshoPeshov.AddDiscipline(csharpDiscipline);
            goshoPeshov.AddDiscipline(oopDiscipline);
            mishoToshov.AddDiscipline(htmlDiscipline);

            var mimiKostova = new Student("Mimi", "Kostova", 123);
            var didiPeshova = new Student("Didi", "Peshova", 567);
            var sisiGoshova = new Student("Sisi", "Goshova", 587);

            csharp.AddTeacher(toshoGoshov);
            csharp.AddTeacher(goshoPeshov);
            oop.AddTeacher(goshoPeshov);
            html.AddTeacher(mishoToshov);

            csharp.AddStudent(mimiKostova);
            oop.AddStudent(mimiKostova);
            html.AddStudent(sisiGoshova);
            html.AddStudent(didiPeshova);

            school.AddCourse(csharp);
            school.AddCourse(oop);
            school.AddCourse(html);

            mimiKostova.AddComment(new Comment("Team Project", "Awesome teammate!", didiPeshova));
            oop.AddComment(new Comment("OOP Principles", "Huh?", sisiGoshova));

            return(school);
        }
Beispiel #3
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)}");
        }