Beispiel #1
0
        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);
        }
 static void Main()
 {
     Console.WriteLine("Small Test:");
     Student mara = new Student("Mara", 55);
     Student pesho = new Student("Pesho", 44);
     Teacher joro = new Teacher("Joro");
     Discipline math = new Discipline("Mathematics", 15, 4);
     joro.AddDiscipline(math);
     SchoolClass myClass = new SchoolClass("1a");
     myClass.AddStudent(mara);
     myClass.AddStudent(pesho);
     myClass.AddTeacher(joro);
     Console.WriteLine(myClass);
     try
     {
         SchoolClass myClass2 = new SchoolClass("1a");
     }
     catch (ArgumentException e)
     {
         Console.WriteLine(e.Message);
     }
     try
     {
         Student gosho = new Student("Gosho", 44);
     }
     catch (ArgumentException e)
     {
         Console.WriteLine(e.Message);
     }
 }
        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);
        }
        static void Main()
        {
            School mySchool = new School("Telerik Academy");

            // Creating students
            Student[] studentsFirstGroup = new Student[]
            {
                new Student("Georgi Yonchev", 2342032),
                new Student("Stamat Stamatov", 3023224),
                new Student("Pesho Ivanov", 3023434),
                new Student("Georgi Ivanov", 2223434),
                new Student("Mariya Ivanova", 4566434),
                new Student("Pesho Todorov", 2000032)
            };

            Student[] studentsSecondGroup = new Student[]
            {
                new Student("Georgi Petrov", 1342032),
                new Student("Albenoa Kalinova", 2333224),
                new Student("Zahari Zahariev", 3023555),
                new Student("Hristo Georgiev", 2234554),
                new Student("Nikoleta Zlatkova", 7765004),
                new Student("Nikoleta Chaneva", 3023100)
            };

            // Creating disciplines
            Discipline cSharp = new Discipline("C Sharp Fundamentals", 30, 30);
            Discipline javaScript = new Discipline("JavaScript Fundamentals", 40, 50);
            Discipline html = new Discipline("HTML5", 12, 13);
            Discipline css = new Discipline("CSS3");

            // Creating teachers
            Teacher teacher1 = new Teacher("Nikolay Kostov");
            Teacher teacher2 = new Teacher("Ivaylo Kenov");
            Teacher teacher3 = new Teacher("Doncho Minkov");
            Teacher teacher4 = new Teacher("Evlogi Hristov");

            teacher1.AddDiscipline(javaScript, html, css);
            teacher2.AddDiscipline(cSharp);
            teacher3.AddDiscipline(html);
            teacher4.AddDiscipline(css);

            // Creating Group classes
            SchoolClass firstGroupClass = new SchoolClass("First Group-morning");
            SchoolClass secondGroupClass = new SchoolClass("Second Group-evening");

            firstGroupClass.AddTeacher(teacher1, teacher2);
            secondGroupClass.AddTeacher(teacher1, teacher3, teacher4);

            firstGroupClass.AddStudent(studentsFirstGroup);
            secondGroupClass.AddStudent(studentsSecondGroup);

            mySchool.AddClass(firstGroupClass);
            mySchool.AddClass(secondGroupClass);
            Console.WriteLine(mySchool);
        }
        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);
            }
        }
 /* 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 a name and unique class number. Classes have unique text identifier.
    Teachers have a name. Disciplines have a 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.
  */
 public static void Main()
 {
     Student dwayne = new Student("Pesho", "Peshov", 6);
     Console.WriteLine("Student name: {0}, Class number: {1}", dwayne.ToString(), dwayne.ClassNumber);
     Teacher firstTeacher = new Teacher(
     "Ivan",
     "Petkov",
     new Discipline("Math", 15, 20),
     new Discipline("Art", 10, 12));
     Console.WriteLine(firstTeacher.ToString());
     Teacher secondTeacher = new Teacher(
     "The",
     "Rock",
     new Discipline("Sports", 30, 40));
     School newSchool = new School(
     new Class("12a", firstTeacher),
     new Class("12b", secondTeacher));
 }
        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);
        }
Beispiel #8
0
        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());
            }
        }
        static void Main(string[] args)
        {
            Student Pesho = new Student("Pesho Konstancaliev", 24, "stupid!");
            Student Lacho = new Student("Lachezar Petrov", 2, "verry stupid!");
            Student Penka = new Student("Penka Grozdanova", 4, "not so stupid!");
            Student Evelina = new Student("Evelina Makedonska", 14, "stupid!");
            Student Evstati = new Student("Evstati Penev", 1, "verry stupid!");
            Student Drago = new Student("Drago Petrov", 11, "stupid!");
            Student Muncho = new Student("Muncho Gunchev", 13, "stupid!");

            Discipline Math = new Discipline("Math", 50, 50, "cool");
            Discipline Geography = new Discipline("Geography", 2, 4, "verry cool");
            Discipline Astronomy = new Discipline("Astronomy", 4, 10, "so-so");

            Teacher Tomov = new Teacher(new Discipline[] {Math, Geography}, "Pesho Tomov", "stupid!");
            Teacher Petrov = new Teacher(new Discipline[] { Astronomy, Geography }, "Harampi Petrov", "verry stupid!");
            Teacher Dragov = new Teacher(new Discipline[] { Math, Astronomy }, "Drago Dragov", "stupid!");
            Teacher Haralambev = new Teacher(new Discipline[] { Math, Geography }, "Mryshtio Haralambev", "stupid!");

            ClassOfStudents theCoolestClass = new ClassOfStudents(new Student[] { Pesho, Evelina, Evstati, Drago }, new Teacher[] { Dragov, Haralambev, Tomov }, "5b");
        }
        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!");
        }
Beispiel #11
0
 public void AddTeachers(Teacher teacher)
 {
     this.teachersSet.Add(teacher);
 }
 public ClassOfStudents(Student[] students, Teacher[] teachers, string identifier, string comment)
     : this(students, teachers, identifier)
 {
     this.Comment = comment;
 }
 public ClassOfStudents(Student[] students, Teacher[] teachers, string identifier)
 {
     this.ClassStudents = students;
     this.ClassTeachers = teachers;
     this.ClassIdentifier = identifier;
 }
Beispiel #14
0
 public void RemoveTeacher(Teacher teacher)
 {
     this.Teachers.Remove(teacher);
 }
Beispiel #15
0
 public void AddTeacher(Teacher teacher)
 {
     this.Teachers.Add(teacher);
 }
Beispiel #16
0
 public void RemoveTeachers(Teacher teacher)
 {
     this.teachersSet.Remove(teacher);
 }
 public void AddTeacherToAClass(Teacher teacher)
 {
     this.teachers.Add(teacher);
 }
Beispiel #18
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("Grafa", 1, "Class leader"),
                new Student("Mara", 2),
                new Student("Miro", 3),
                new Student("Lyubcho", 4)
            };

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

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

            var disciplines = new List <Discipline>
            {
                new Discipline("Maths", 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 petrova = new Teacher("Tsanka Petrova", new List <Discipline>()
            {
                new Discipline("Physics", 10, 10)
            });
            Teacher pavlov = new Teacher("Tosho Pavlov", new List <Discipline>()
            {
                new Discipline("Maths", 10, 10)
            });

            List <Teacher> teachers = new List <Teacher>()
            {
                petrova, pavlov
            };

            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>()
            {
                petrova
            },
                                   new List <Student>()
            {
                new Student("Todor", 1), new Student("Yana", 2)
            });

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

            tenA.Comment = "Very good results last year!";
            Console.WriteLine("\n\nClass \"{0}\" comment: {1}\n", tenA.ClassID, tenA.Comment);
        }
        public static void Main()
        {
            var school = new School("PG Gen. Vl. Zaimov");

            //students
            var ivan = new Student("Ivan Ivanov", 100011);
            var stoyan = new Student("Stoyan Stoyanov", 100012);
            var dragan = new Student("Dragan Draganov", 200011);
            var pesho = new Student("Pesho Peshov", 200012);

            //teachers
            var ivo = new Teacher("Ivaylo Kenov");
            var niki = new Teacher("Nikolay Kostov");
            var doncho = new Teacher("Doncho Minkov");
            var evlogi = new Teacher("Evlogi Hristov");

            //classes
            var firstClass = new SchoolClass("100");
            var secondClass = new SchoolClass("200");

            //disciplines
            var geography = new Discipline("Geography", 2, 2);
            var history = new Discipline("History", 1, 2);
            var biology = new Discipline("Biology", 3, 1);
            var math = new Discipline("Math", 3, 2);
            var mpt = new Discipline("MPT", 1, 3);

            //adding classes to school
            school.AddClass(firstClass);
            school.AddClass(secondClass);

            //adding teachers and students to classes
            firstClass.AddStudents(ivan);
            firstClass.AddStudents(stoyan);
            firstClass.AddTeachers(ivo);
            firstClass.AddTeachers(evlogi);

            secondClass.AddStudents(dragan);
            secondClass.AddStudents(pesho);
            secondClass.AddTeachers(doncho);
            secondClass.AddTeachers(niki);

            //adding disciplines to teachers
            ivo.AddDisciplines(geography);
            niki.AddDisciplines(biology);
            doncho.AddDisciplines(mpt);
            doncho.AddDisciplines(geography);
            ivo.AddDisciplines(history);
            evlogi.AddDisciplines(biology);

            ivan.Comment = "I like geography!";

            doncho.Comment = "Something.";

            geography.Comment = "Surface of Earth......";

            firstClass.Comment = "Advanced.";

            Console.WriteLine("{0, 28}", school);
            Console.WriteLine(new string('*', 40));
            Console.WriteLine("Class identifier: {0}", firstClass);
            Console.WriteLine("\nStudents: \n{0}", firstClass.GetStudents());
            Console.WriteLine("Teachers: \n{0}", firstClass.GetTeachers());
            Console.WriteLine("Teacher's disciplines: ");
            Console.WriteLine("{0}\n{1}",ivo, ivo.GetDisciplines());
            Console.WriteLine("{0}\n{1}", evlogi, evlogi.GetDisciplines());

            Console.WriteLine("Comments:");
            Console.WriteLine("{0}: {1}", ivan.Name, ivan.Comment);
            Console.WriteLine("{0}: {1}", geography.Name, geography.Comment);
        }