コード例 #1
0
ファイル: Test.cs プロジェクト: g-yonchev/Telerik-Academy
        public static void Main()
        {
            var firstDiscipline = new Discipline("HTML", 10, 10);
            var secondDiscipline = new Discipline("JavaScript", 25, 25);
            var thirdDiscipline = new Discipline("CSS", 15, 5);

            var fourthDiscipline = new Discipline("OOP", 15, 20);
            fourthDiscipline.AddComment("Best course ever");

            var fifthDiscipline = new Discipline("C#", 20, 25);

            Teacher firstTeacher = new Teacher("Ivancho", firstDiscipline, secondDiscipline, thirdDiscipline);
            Teacher secondTeacher = new Teacher("Marcheto", secondDiscipline, fourthDiscipline);

            Teacher thirdTeacher = new Teacher("Bojana", fifthDiscipline, thirdDiscipline);
            thirdTeacher.AddComment("Very lazy");

            Teacher fourthTeacher = new Teacher("Joreto", secondDiscipline, thirdDiscipline, fourthDiscipline, fifthDiscipline);
            Teacher fifthTeacher = new Teacher("Albena", fourthDiscipline, fifthDiscipline, secondDiscipline);

            Class classA = new Class("A", firstTeacher, secondTeacher, thirdTeacher);
            classA.AddComment("The best class of the academy");

            Class classB = new Class("B", fourthTeacher, fifthTeacher);

            School telerikAcademy = new School();
            telerikAcademy.AddClass(classA);
            telerikAcademy.AddClass(classB);
        }
コード例 #2
0
        public static void Main()
        {
            School school = new School("Test school");
            Console.WriteLine("School name: \"{0}\"\n", school.Name);

            var students = new List<Student>
            {
                new Student("Pesho", 1, "Class leader"),
                new Student("Gosho", 2),
                new Student("Ivo", 3),
                new Student("Doncho", 4)
            };

            Console.WriteLine("\nList of students: \n");

            foreach (var student in students)
            {
                Console.WriteLine(student);
            }

            var disciplines = new List<Discipline>
            {
                new Discipline("Math", 15, 15)
            };

            Discipline physics = new Discipline("Physics", 10, 10);
            disciplines.Add(physics);

            Console.WriteLine("\n\nList of disciplines:\n");

            foreach (var discipline in disciplines)
            {
                Console.WriteLine(discipline);
                Console.WriteLine();
            }

            Teacher peshov = new Teacher("Pesho Peshov", new List<Discipline>() { new Discipline("Physics", 10, 10) });
            Teacher goshev = new Teacher("Gosho Goshev", new List<Discipline>() { new Discipline("Math", 10, 10) });

            List<Teacher> teachers = new List<Teacher>() { peshov, goshev };

            Console.WriteLine("\nList of teachers:\n");

            foreach (Teacher teacher in teachers)
            {
                Console.WriteLine("{0} {1}", teacher.FullName, string.Join("\n", teacher.DisciplinesList));
                Console.WriteLine();
            }

            Class tenA = new Class("10 A",
                new List<Teacher>() { peshov },
                new List<Student>() { new Student("Toshko", 1), new Student("Peshka", 2) });

            Console.WriteLine("\nClass: ");
            Console.WriteLine(tenA);

            tenA.Comment = "Very good results last year!";
            Console.WriteLine("\n\nClass \"{0}\" comment: {1}\n", tenA.ClassID,tenA.Comment);
        }
コード例 #3
0
ファイル: School.cs プロジェクト: Vyara/Telerik-Academy
        public void RemoveClass(Class exsistingClass)
        {
            if (!this.Classes.Contains(exsistingClass))
            {
                throw new ArgumentException("There is no such class.");
            }

            this.Classes.Remove(exsistingClass);
        }
コード例 #4
0
        static void Main()
        {
            Student pesho = new Student("Pesho", 8);
            Student gosho = new Student("Gosho", 8, "kaval");
            Teacher stamatov = new Teacher("Stamatov", "bastun");
            Teacher petrova = new Teacher("Petrova");

            Class myClass = new Class("A");
            myClass.AddStudent(pesho);
            myClass.AddStudent(gosho);
            myClass.AddTeacher(stamatov);
            myClass.AddTeacher(petrova);

            Discipline biologia = new Discipline("biologia", 30, 30);
            Discipline matematika = new Discipline("matematika", 40, 40, "cool");

            stamatov.AddDiscipline(biologia);
            petrova.AddDiscipline(matematika);

            for (int i = 0; i < myClass.Students.Count; i++)
            {
                Console.WriteLine(myClass.Students[i].Name);
            }

            Console.WriteLine();
            myClass.RemoveStudent(pesho);

            for (int i = 0; i < myClass.Students.Count; i++)
            {
                Console.WriteLine(myClass.Students[i].Name);
            }

            Console.WriteLine();

            for (int i = 0; i < myClass.Teachers.Count; i++)
            {
                Console.WriteLine(myClass.Teachers[i].Name);
            }

            myClass.RemoveTeacher(petrova);
            Console.WriteLine();

            for (int i = 0; i < myClass.Teachers.Count; i++)
            {
                Console.WriteLine(myClass.Teachers[i].Name);
            }

            stamatov.AddDiscipline(matematika);
            Console.WriteLine();

            for (int i = 0; i < stamatov.Disciplines.Count; i++)
            {
                Console.WriteLine(stamatov.Disciplines[i].NameOfDiscipline);
            }
        }
コード例 #5
0
        static void Main()
        {
            School school = new School("PMG");

            Class firstClass = new Class('A');
            Class secondClass = new Class('B');
            Class thirdClass = new Class('V');

            Teacher firstTeacher = new Teacher("Janeta", "super!");
            Teacher secondTeacher = new Teacher("Gonzo", "stranen");

            Student firstStudent = new Student("Ivan", "111213", "razdraznitelen");
            Student secondStudent = new Student("Dragan", "111214", "otkachen");
            Student thirdStudent = new Student("Petkan", "111215");
            Student forthStudent = new Student("Stamat", "111216", "uchenolubiv");

            Discipline math = new Discipline("Math", 5, 10);
            Discipline history = new Discipline("History", 2, 4);
            Discipline physics = new Discipline("Physics", 4, 8);
            Discipline english = new Discipline("English", 2, 4);

            school.AddClass(firstClass);
            school.AddClass(secondClass);
            school.AddClass(thirdClass);

            firstTeacher.AddDiscipline(math);
            firstTeacher.AddDiscipline(english);
            secondTeacher.AddDiscipline(history);
            secondTeacher.AddDiscipline(physics);

            firstClass.AddStudentToAClass(firstStudent);
            firstClass.AddStudentToAClass(secondStudent);
            secondClass.AddStudentToAClass(thirdStudent);
            thirdClass.AddStudentToAClass(forthStudent);

            firstClass.AddTeacherToAClass(firstTeacher);
            firstClass.AddTeacherToAClass(secondTeacher);
            secondClass.AddTeacherToAClass(firstTeacher);
            thirdClass.AddTeacherToAClass(secondTeacher);

            Console.WriteLine("School named {0} has {1} classes: \n\n {2} {3} {4}", school.Name, school.Classes.Count, firstClass, secondClass, thirdClass);
        }
コード例 #6
0
ファイル: StartPoint.cs プロジェクト: p0150n/TelerikAcademy
        static void Main()
        {
            List<Discipline> disciplines = new List<Discipline>();
            List<Student> students = new List<Student>();
            for (int i = 0; i < 15; i++)
            {
                disciplines.Add(new Discipline(string.Format("Discipline {0}", i + 1), i * 2 + 1, i * 3 + 2));
                students.Add(new Student(string.Format("Pesho {0}{1}{0}", (char)(66 + i), (char)(65 + i)),i + 1));
            }

            List<Teacher> teachers = new List<Teacher>() {
                new Teacher("Ivanka Petrova") { Disciplines = disciplines, Comment = "Pechena e :)"},
                new Teacher("Gergana Ivanova") { Disciplines = {disciplines[0], disciplines[6], disciplines[8]}, Comment = "Stava :)"},
                new Teacher("Poli Hristova") { Disciplines = {disciplines[4], disciplines[5], disciplines[7]}, Comment = "Losha :)"},
                new Teacher("Velichka Andreeva") { Disciplines = {disciplines[8], disciplines[12], disciplines[14]}, Comment = "Stava :)"}
            };
            Class myClass = new Class("8a", students, teachers);
            School mySchool = new School();
            mySchool.Name = "Hristo Botev";
            mySchool.Classes.Add(myClass);
            Console.WriteLine("School name: {0}", mySchool.Name);
            foreach (var pClass in mySchool.Classes)
            {
                Console.WriteLine("  Class: {0}", pClass.TextIdentifier);
                Console.WriteLine("  Students: ");
                foreach (var st in pClass.Students)
                {
                    Console.WriteLine("    Name: {0}, Num: {1}", st.Name, st.ClassNumber);
                }

                Console.WriteLine("  Teachers: ");
                foreach (var teach in pClass.Teachers)
                {
                    Console.WriteLine("    Name: {0}",teach.Name);
                    Console.WriteLine("    Disciplines: ");
                    foreach (var disc in teach.Disciplines)
                    {
                        Console.WriteLine("       {0} Lectures: {1}, Exercises: {2}", disc.Name, disc.NumLectures, disc.NumExercises);
                    }
                }
            }
        }
コード例 #7
0
ファイル: EntryPoint.cs プロジェクト: VanyaD/CSharp-OOP
        static void Main()
        {
            Teacher teacher1 = new Teacher("Vanya", "Karaasenova");
            Teacher teacher2 = new Teacher("Maya", "Dobreva");
            teacher1.AddDiscipline(new Discipline("Chemistry", 12, 10));
            teacher1.AddDiscipline(new Discipline("Sport", 7, 5));

            Console.WriteLine("Teachers details:");
            Console.WriteLine(teacher1.ToString());
            Console.WriteLine(teacher2.ToString());

            Class testClass = new Class("12");
            testClass.AddDiscipline(new Discipline("Chemistry", 12, 10));
            teacher2.AssignGroup(testClass);

            foreach (Discipline discipline in testClass.Disciplines)
            {
                Console.WriteLine(discipline.ToString());
            }
        }
コード例 #8
0
        static void Main()
        {
            Student aniPetrova = new Student("Ani"," Petrova", 1);
            Student gerogiMalinov = new Student("Gerogi"," Malinov",2);
            Student hristoVasilev = new Student("Hristo ","Vasilev",3);

            List<Student> studentsInClassA = new List<Student>();
            studentsInClassA.Add(aniPetrova);
            studentsInClassA.Add(gerogiMalinov);
            studentsInClassA.Add(hristoVasilev);

            foreach (var student in studentsInClassA)
            {
                Console.WriteLine(student.ToString());
            }
            Console.WriteLine();

            Discipline math = new Discipline("Math", 10, 10);
            Discipline language = new Discipline("Language", 20, 10);
            Discipline art = new Discipline("Art", 5, 10);

            Teacher petarPetrov = new Teacher("Petar"," Petrov");
            petarPetrov.AddDiscipline (math);
            petarPetrov.AddDiscipline(language);

            Teacher peshoPeshov = new Teacher("Pesho" ,"Peshov");
            peshoPeshov.AddDiscipline(art);

            List<Teacher> teachersForAClass = new List<Teacher>() { petarPetrov, peshoPeshov };

            Class classA = new Class("5A");
            classA.AddTeacher(petarPetrov);
            classA.AddTeacher(peshoPeshov);
            Console.WriteLine(classA.ToString() + "\n" + string.Join("", classA.TeachersSet));

            classA.AddComment("Hello");
            classA.AddComment("This is our first class.");
            classA.AddComment("This is our last class!");
        }
コード例 #9
0
ファイル: Teacher.cs プロジェクト: VanyaD/CSharp-OOP
 public void AssignGroup(Class group)
 {
     this.GroupsAssigned.Add(group);
 }
コード例 #10
0
 public void RemoveClass(Class oldClass)
 {
     this.classes.Remove(oldClass);
 }
コード例 #11
0
 public void AddClass(Class newClass)
 {
     this.classes.Add(newClass);
 }
コード例 #12
0
ファイル: School.cs プロジェクト: tima-t/Telerik-Academy
 public void AddClass(Class Class)
 {
     this.Classes.Add(Class);
 }
コード例 #13
0
ファイル: School.cs プロジェクト: DareDev1l/TelerikAcademy
 public void AddClass(Class group)
 {
     this.classes.Add(group);
 }