コード例 #1
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);
            }
        }
コード例 #2
0
ファイル: School.cs プロジェクト: niksmanov/Telerik_Academy
        internal static void Main()
        {
            var firstStudent  = new Student("Gosho", "Goshov", 1234);
            var secondStudent = new Student("Ivan", "Ivanov", 123456);
            var thirdStudent  = new Student("Pesho", "Peshov", 12345678);

            var firstDiscipline  = new Disciplines("Math", 12, 36);
            var secondDiscipline = new Disciplines("English", 28, 56);
            var thirdDiscipline  = new Disciplines("Biology", 4, 12);

            var firstTeacher  = new Teacher("Ginka", "Ginkova");
            var secondTeacher = new Teacher("Manol", "Manolov");
            var thirdTeacher  = new Teacher("Grisho", "Grishov");

            var firstClass  = new Class("XII A");
            var secondClass = new Class("VI B");
            var thirdClass  = new Class("III D");

            firstTeacher.AddDiscipline(firstDiscipline);
            firstTeacher.AddDiscipline(secondDiscipline);
            firstTeacher.AddDiscipline(thirdDiscipline);

            firstClass.AddStudent(firstStudent);
            firstClass.AddTeacher(firstTeacher);


            //Prints//
            firstStudent.Print();

            firstDiscipline.Print();

            firstTeacher.Print();

            firstClass.Print();
        }
コード例 #3
0
        private static List <Class> FillSchool()
        {
            List <Class> classes = new List <Class>();

            Class math = new Class(GetStudents(),
                                   "Mathematics",
                                   new Teacher("Chicho Mitko", new Discipline("Math", 2, 4), new Discipline("Physics", 2, 4)));

            math.AddStudent(new Student("Pesho", 5));
            math.AddTeacher(new Teacher("Chicho Gosho", new Discipline("Distillery", 4, 6)));
            math.AddComment("Yeah, quite interesting.");
            math.Teachers[1].Disciplines[0].AddComment("Beer.");

            classes.Add(math);

            Class philosophy = new Class(GetStudents(),
                                         "Phylosophy",
                                         new Teacher("Chicho Pencho", new Discipline("Math", 2, 4), new Discipline("Physics", 2, 4)),
                                         new Teacher("Chicho Gencho", new Discipline("Philosophy", 3, 5)));

            philosophy.Teachers[1].AddDiscipline(new Discipline("Transcendental metascience", 2, 1));
            philosophy.Teachers[0].AddComment("Everybody likes him.");

            classes.Add(philosophy);

            return(classes);
        }
コード例 #4
0
        private static School LoadSchool()
        {
            School school = new School("Geo Milev");

            Class eightA = new Class("8a");

            eightA.Comment = "Will participate in the school project.";
            Class eightB = new Class("8b");

            Student pesho = new Student("Pesho");

            pesho.Comment = "Call the parents.";
            Student ivan = new Student("Ivan");

            Discipline math    = new Discipline("Math", 8, 8);
            Discipline physics = new Discipline("Physics", 6, 6);

            Teacher petrova = new Teacher("Petrova");
            Teacher ivanova = new Teacher("Ivanova");

            ivanova.Comment = "Agreed to show the kids the NASA shuttle.";

            petrova.AddDiscipline(math);
            ivanova.AddDiscipline(physics);

            eightA.AddStudent(pesho);
            eightA.AddTeacher(petrova);
            eightB.AddStudent(ivan);
            eightB.AddTeacher(ivanova);

            school.AddClass(eightA);
            school.AddClass(eightB);

            return(school);
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: IoanaCj/week02
        static void Main(string[] args)
        {
            Student s1 = new Student("Popescu I", "2B", "Present");
            Student s2 = new Student("Dolanescu G", "3A", "Present");
            Student s3 = new Student("Gigi A", "2B", "Absent");
            Student s4 = new Student("Aionei F", "3A", "Present");

            Disciplines d1 = new Disciplines("Mathematics", 10, 30);
            Disciplines d2 = new Disciplines("French", 6, 10);
            Disciplines d3 = new Disciplines("Physics", 15, 9);
            Disciplines d4 = new Disciplines("Nature science", 12, 20);

            Teacher t1 = new Teacher("First Teacher");

            t1.AddDiscipline(d1);
            t1.AddDiscipline(d3);
            Teacher t2 = new Teacher("Second Teacher");

            t2.AddDiscipline(d2);
            t2.AddDiscipline(d4);


            Class c1 = new Class("3A");

            c1.AddTeacher(t1);
            c1.AddStudent(s2);
            c1.AddStudent(s4);

            Class c2 = new Class("2B");

            c2.AddTeacher(t2);
            c2.AddStudent(s1);
            c2.AddStudent(s3);

            School s = new School("Ion Creanga", "Iasi");

            s.AddClass(c1);
            s.AddClass(c2);

            s.Print();

            Console.ReadKey();
        }
コード例 #6
0
        static void Main()
        {
            Class   newClass = new Class();
            Teacher ivan     = new Teacher("Ivan Ivanov");
            Teacher petar    = new Teacher("Petar Petrov");

            newClass.AddTeacher(ivan);
            newClass.AddTeacher(petar);
            Discipline maths   = new Discipline("Maths", 4, 4);
            Discipline physics = new Discipline("Physics", 2, 3);

            ivan.AddDiscipline(maths);
            ivan.AddDiscipline(physics);
            petar.AddDiscipline(maths);

            Console.WriteLine(newClass);

            foreach (var teacher in newClass.Teachers)
            {
                Console.WriteLine(teacher);
                teacher.showDisciplines();
            }
            Console.WriteLine();

            Student petya  = new Student("Petya Petkova");
            Student mariya = new Student("Mariya Petkova");
            Student tanya  = new Student("Tanya Petkova");

            newClass.AddStudent(petya);
            newClass.AddStudent(mariya);
            newClass.AddStudent(tanya);

            foreach (var item in newClass.Students)
            {
                Console.WriteLine(item);
            }
        }
コード例 #7
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());
        }
コード例 #8
0
ファイル: Startup.cs プロジェクト: flashd2n/main-telerik-git
        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)}");
        }