Exemplo n.º 1
0
        static void Main()
        {
            List<Student> students = new List<Student>() {
            new Student("Ivan Petrov", "Needed more motivation"),
            new Student("Dragan Ivanov"),
            new Student("Gosho Peshev")
            };

            List<Discipline> disciplines= new List<Discipline>(){

                new Discipline("Mathematics", 3, 20, "More Lectures Needed"),
                new Discipline("Chemistry", 2, 10),
                new Discipline("Informatics", 1, 30)

            };

            List<Teacher> teachers = new List<Teacher>{
                new Teacher("Mento Menteshev","Please review load", disciplines),
                new Teacher("Tconio Bonev", disciplines),
                new Teacher("Stoino Koinov", disciplines)
            };

            SchoolClass firstA = new SchoolClass(students, teachers, "firstA");

            Console.WriteLine(firstA);
        }
 public void RecordingMoreStudentsThanAvailableIdsShouldThrowStudentIdException()
 {
     var school = new SchoolClass();
     for (int i = Constants.StudentIdMinValue; i <= Constants.StudentIdMaxValue + 1; i++)
     {
         var student = new Student("Pesho");
         school.RecordStudent(student);
     }
 }
        public void RecordingStudentTwiceShouldReturnTheSameId()
        {
            var student = new Student("Pesho");
            var school = new SchoolClass();

            int idFromFirstRecording = school.RecordStudent(student);
            int idFromSecondRecording = school.RecordStudent(student);

            Assert.AreEqual(idFromFirstRecording, idFromSecondRecording);
        }
        public void GetStudentByIdShouldReturnNullWhenStudentIdIsNotFound()
        {
            var school = new SchoolClass();
            var student = new Student("Pesho");

            var id = school.RecordStudent(student);
            var notExistingId = id + 1;

            Assert.IsNull(school.GetStudentById(notExistingId));
        }
        public void AddSchoolClass(SchoolClass schoolClass)
        {
            if (this.schoolClasses.Any(schClass => schClass.NameID.Equals(schoolClass.NameID, StringComparison.InvariantCultureIgnoreCase)))
            {
                throw new ArgumentException(
                    String.Format("SchoolClass NameID must be unique. There is already defined SchoolClass with NameID {0}", schoolClass.NameID));
            }

            this.schoolClasses.Add(schoolClass);
        }
Exemplo n.º 6
0
 public void AddClass(SchoolClass newClass)
 {
     if (schoolClasses.ContainsKey(newClass.GetUnqID))
     {
         throw new ArgumentException("Existing class");
     }
     else
     {
         schoolClasses.Add(newClass.GetUnqID, newClass);
     }
 }
        public void RecordedStudentsShouldHavveDifferentIds()
        {
            var student1 = new Student("Pesho");
            var student2 = new Student("Pesho");

            var school = new SchoolClass();
            int student1Id = school.RecordStudent(student1);
            int student2Id = school.RecordStudent(student2);

            Assert.AreNotEqual(student1Id, student2Id);
        }
Exemplo n.º 8
0
        static void Main()
        {
            Student student = new Student("Nerd", "12345");

            Teacher teacher = new Teacher("Shibanqk");

            SchoolClass math = new SchoolClass("math");

            math.AddStudent(student);
            math.AddComment("asdf");
            Console.WriteLine(math);
        }
        public void GetStudentByIdShouldReturnTheStudentWithTheId()
        {
            var student1 = new Student("Pesho");
            var student2 = new Student("Pesho");

            var school = new SchoolClass();
            int student1Id = school.RecordStudent(student1);
            int student2Id = school.RecordStudent(student2);

            Assert.AreSame(student1, school.GetStudentById(student1Id), "The first student is not the same as the returned student with the first id");
            Assert.AreSame(student2, school.GetStudentById(student2Id), "The second student is not the same as the returned student with the second id");
        }
        static void Main()
        {
            School scholl = new School("MG Petar Beron");

            SchoolClass schClass = new SchoolClass("4a");
            scholl.AddSchoolClass(schClass);

            Student student = new Student("Anna Dimova", 1);
            schClass.AddStudent(student);
            student = new Student("Biljana Asenova", 2);
            schClass.AddStudent(student);
            student = new Student("Georgi Ivanov", 3);
            schClass.AddStudent(student);
            student = new Student("Emil Stojanov", 4);
            schClass.AddStudent(student);

            Teacher teacherMath = new Teacher("Radka Petrova");
            Discipline discipline = new Discipline("Mathematics", 5, 2);
            teacherMath.AddDiscipline(discipline);
            discipline = new Discipline("Informatics", 3, 2);
            teacherMath.AddDiscipline(discipline);

            schClass.AddTeacher(teacherMath);

            Teacher teacherChem = new Teacher("Stojanka Stojanova");
            discipline = new Discipline("Chemistry", 5, 2);
            teacherChem.AddDiscipline(discipline);

            schClass.AddTeacher(teacherChem);

            Teacher teacherEng = new Teacher("Ivo Nikolov");
            discipline = new Discipline("Englich", 3, 1);
            teacherEng.AddDiscipline(discipline);

            schClass = new SchoolClass("4b");
            scholl.AddSchoolClass(schClass);

            student = new Student("Angel Dimov", 1);
            schClass.AddStudent(student);
            student = new Student("Bojan Ivanov", 2);
            schClass.AddStudent(student);
            student = new Student("Georgi Stojanov", 3);
            schClass.AddStudent(student);
            student = new Student("Emilija Dimova", 4);
            schClass.AddStudent(student);

            schClass.AddTeacher(teacherMath);
            schClass.AddTeacher(teacherChem);
            schClass.AddTeacher(teacherEng);

            Console.WriteLine(scholl);
        }
Exemplo n.º 11
0
        static void Main()
        {
            var mySchool = new School("My School");
            var class1   = new SchoolClass();
            var class2   = new SchoolClass();

            mySchool.SchoolClass.Add(class1);

            //test add & remove class
            mySchool.SchoolClass.Add(class2);
            mySchool.PrintClasses();
            //mySchool.SchoolClass.Remove(class2);
            mySchool.RemoveClass("B");
            Console.WriteLine("<After the removal of class B>");
            mySchool.PrintClasses();

            //test add & remove students
            class1.AddStudent(new Student("Angel Angelov"));
            class1.AddStudent(new Student("Borislav Borisov"));
            class1.RemoveStudent("Angel Angelov");

            //test add & remove teachers
            class1.AddTeacher(new Teacher("White Death", new List <SchoolSubject> {
                new SchoolSubject("Math", 20, 30),
                new SchoolSubject("Biology", 10, 10),
                new SchoolSubject("English Literature", 20, 20)
            }));

            //test add & remove subject
            class1.AddSubject("White Death", new SchoolSubject("Rocket Science", 100, 100));
            class1.RemoveSubject("White Death", "Biology");
            class1.Comment = "My DreamClass";
            var blackDeath = new Teacher("Black Death", new List <SchoolSubject> {
                new SchoolSubject("Chemistry", 20, 30),
                new SchoolSubject("Physics", 10, 10)
            });

            class1.ClassTeachers.Add(blackDeath);
            blackDeath.SetOfSubjects.Add(new SchoolSubject("Student Executions", 1, 1));
            blackDeath.Comment = "My DreamTeacher";
            var aStudent = new Student("Gargamel Petrov");

            aStudent.Comment = "complete idiot";
            class1.AddStudent(aStudent);
            //Console.WriteLine(class1);
            Console.WriteLine("Print the contents of my school:");
            Console.WriteLine(mySchool);
        }
Exemplo n.º 12
0
        static void Main(string[] args)
        {
            //NEW SCHOOLCLASSES
            SchoolClass classA = new SchoolClass();
            SchoolClass classB = new SchoolClass();
            SchoolClass classC = new SchoolClass();
            SchoolClass classD = new SchoolClass();

            //NEW TEACHERS
            Teacher teacher1 = new Teacher("Adam Wesołowski", "Matematyka", 32, 34);
            Teacher teacher2 = new Teacher("Ewa Matuszewska", "Język polski", 32, 50);
            Teacher teacher3 = new Teacher("Wojciech Olszewski", "Fizyka", 22, 34);
            Teacher teacher4 = new Teacher("Zbigniew Zamachowski", "Filozofia", 40, 40);

            //ADDING TEACHERS TO THE LIST
            Teacher teacher = new Teacher();

            teacher.addTeacher(teacher1);
            teacher.addTeacher(teacher2);
            teacher.addTeacher(teacher3);
            teacher.addTeacher(teacher4);
            teacher.addTeacher(teacher4);//it will result in message "Zbigniew Zamachowski has been already added"
            teacher.printTeacher();

            //ADDING TEACHERS TO CLASSES
            classA.addTeachersToClass(teacher1);
            classA.addTeachersToClass(teacher2);
            classA.addTeachersToClass(teacher3);
            classB.addTeachersToClass(teacher3);
            classB.addTeachersToClass(teacher2);
            classC.addTeachersToClass(teacher1);
            classC.addTeachersToClass(teacher4);
            classD.addTeachersToClass(teacher4);

            //NUMBER OF TEACHERS IN CLASS
            classA.numberOfTeachers();

            //ADDING STUDENTS TO CLASSES
            classA.addStudent(1, "Maciej Kononowicz");
            classA.addStudent(2, "Adam Zagłębny");
            classA.addStudent(3, "Mirosław Baka");
            //classA.addStudent(3, "Weronika Migdałowska")//adding the same ID will result in error

            classA.printStudent(1);    //print single student
            classA.printStudent(5);    //it wil result in "There is no student with this id" message
            classA.printAllStudents(); //print all students from classA
        }
Exemplo n.º 13
0
        private static void Main()
        {
            var discip = new[] 
            { 
                new Discipline("Math", 10, 5),
                new Discipline("History", 8, 2) 
            };
            var teacher1 = new Teacher("Pesho Petrov", discip, "Test comment");
            var teacher2 = new Teacher("Gandalf The Grey", discip);
            Console.WriteLine(teacher1);

            var student1 = new Student("Pesho Hristov", 13, "Tapak");
            var student2 = new Student("Foobar Foobarov", 54, "Genius");

            var test = new SchoolClass("12-g", new[] { student1, student2 }, new[] { teacher1, teacher2 });
            Console.WriteLine(test);
        }
Exemplo n.º 14
0
        static void Main()
        {
            List <IPerson> people      = new List <IPerson>();
            SchoolClass    schoolClass = new SchoolClass("FirstClass", 2);
            Student        pesho       = new Student(2, "Pesho", "Very good student!");
            Teacher        gosho       = new Teacher("Gosho");
            Discipline     disciplina  = new Discipline("Mathematics", 4, 4);
            Discipline     disciplina2 = new Discipline("Biology", 4, 5);

            gosho.AddDiscipline(disciplina);
            gosho.AddDiscipline(disciplina2);
            people.Add(pesho);
            people.Add(gosho);
            foreach (var item in people)
            {
                Console.WriteLine(item);
            }
        }
Exemplo n.º 15
0
        public static void Main()
        {
            var nakovDisciplines = new List <Disciplines>
            {
                new Disciplines(DisciplineName.Math, 10, 10),
                new Disciplines(DisciplineName.Informatics, 20, 20)
            };

            var kiroDisciplines = new List <Disciplines>
            {
                new Disciplines(DisciplineName.History, 8, 8),
                new Disciplines(DisciplineName.Geography, 6, 6)
            };

            var studentsClassA = new List <Student>
            {
                new Student("Pesho", "Peshov"),
                new Student("Gosho", "Goshov"),
                new Student("Ivo", "Ivov")
            };

            var studentsClassB = new List <Student>
            {
                new Student("Mariika", "Mariikova"),
                new Student("Todorka", "Todorkova"),
                new Student("Stoyanka", "Stoyankova")
            };

            var teachers = new List <Teacher>
            {
                new Teacher("Svetlin", "Nakov", nakovDisciplines),
                new Teacher("Kiro", "Kirov", kiroDisciplines)
            };

            var classA = new SchoolClass(teachers, studentsClassA);
            var classB = new SchoolClass(teachers, studentsClassB);

            var school = new School(new List <SchoolClass> {
                classA, classB
            });

            Console.WriteLine(school);
        }
Exemplo n.º 16
0
        private static void Main()
        {
            var discip = new[]
            {
                new Discipline("Math", 10, 5),
                new Discipline("History", 8, 2)
            };
            var teacher1 = new Teacher("Pesho Petrov", discip, "Test comment");
            var teacher2 = new Teacher("Gandalf The Grey", discip);

            Console.WriteLine(teacher1);

            var student1 = new Student("Pesho Hristov", 13, "Tapak");
            var student2 = new Student("Foobar Foobarov", 54, "Genius");

            var test = new SchoolClass("12-g", new[] { student1, student2 }, new[] { teacher1, teacher2 });

            Console.WriteLine(test);
        }
        static void Main()
        {
            var gosheto = new Student("Gosho Gosheto", 5, "Not brilliant");
            var koko    = new Student("Kolio Koko", 15, "Sportsman");
            var gichka  = new Student("Gichka P.", 7, "Everybody KNOWS her");
            var meto    = new Student("Metodi Izqdeuchebnikov", 18, "Studies hard");
            var ji      = new Student("Zhivko", 25);

            var chetene  = new Discipline("Chetene", 20, new Student[] { gosheto, meto, ji });
            var risuvane = new Discipline("Risuvane", 15, new Student[] { koko, gichka, ji, meto });
            var sport    = new Discipline("Sport", 20, new Student[] { koko }, "Fizichesko vyzpitanie");

            var kipachev = new Teacher("P. Kipachev", new Discipline[] { chetene, risuvane });
            var fochev   = new Teacher("K. Fochev", new Discipline[] { sport });

            var klas = new SchoolClass("A", new Teacher[] { kipachev, fochev });

            Console.WriteLine(klas); //Intentionally left the \n for easier comprehension.
        }
Exemplo n.º 18
0
 static void Main()
 {
     School MySchool = new School("Telerik Academy");
     Student[] myArrStudents = {new Student("Ivan","Ivanov","good skills"), new Student("Petya", "Nikolova"),
                                new Student("Stoyan","Stalev")};
     List<Student> myStudents = myArrStudents.ToList();
     List<Discipline> nakovDisciplines = new List<Discipline>();
     nakovDisciplines.Add(new Discipline("OOP", 10, 9));
     nakovDisciplines.Add(new Discipline("C#2", 10, 10));
     List<Discipline> nikiDisciplines = new List<Discipline>();
     nikiDisciplines.Add(new Discipline("OOP", 10, 9));
     nikiDisciplines.Add(new Discipline("C#1", 6, 6));
     Teacher[] myArrTeachers = { new Teacher("Svetlin", "Nakov", nakovDisciplines, "The boss"), new Teacher("Nikolay","Kostov", nikiDisciplines)};
     List<Teacher> myTeachers = myArrTeachers.ToList();
     SchoolClass myClass = new SchoolClass(myTeachers, myStudents, "test class");
     SchoolClass otherClass = new SchoolClass(myTeachers);
     MySchool.AllClasses.Add(myClass);
     MySchool.AllClasses.Add(otherClass);
     Console.WriteLine(MySchool);
 }
Exemplo n.º 19
0
        static void Main()
        {
            School TelerikSchool = new School("Telerik");

            SchoolClass telerikClass = new SchoolClass();
            SchoolClass writersClass = new SchoolClass();
            SchoolClass dotaCharactersClass = new SchoolClass();

            telerikClass.AddStudent(new Student("Svetlin", "Nakov", 30));
            telerikClass.AddStudent(new Student("Doncho", "Minkov", 25));
            telerikClass.AddStudent(new Student("Nikolay", "Kostov", 23));
            telerikClass.AddStudent(new Student("George", "Georgiev", 22));
            telerikClass.AddTeacher(new Teacher("Pavel", "Kolev", 24));
            telerikClass.AddTeacher(new Teacher("Mihail", "Petrov", 23));
            telerikClass.AddTeacher(new Teacher("Lyubomir", "Yanchev", 18));

            writersClass.AddStudent(new Student("Ivan", "Vazov", 23));
            writersClass.AddStudent(new Student("Lyuben", "Karavelov", 22));
            writersClass.AddTeacher(new Teacher("Dimcho", "Debelqnov", 24));
            writersClass.AddTeacher(new Teacher("Nikola", "Vapcarov", 23));

            dotaCharactersClass.AddStudent(new Student("Tinker", "Bouch", 22));
            dotaCharactersClass.AddStudent(new Student("Spectre", "Mercurial", 22));
            dotaCharactersClass.AddStudent(new Student("Alleria", "Windrunner", 22));
            dotaCharactersClass.AddStudent(new Student("Drow", "Ranger", 22));
            dotaCharactersClass.AddTeacher(new Teacher("Zeus", "Lord of olympia", 24));
            dotaCharactersClass.AddTeacher(new Teacher("Kunka", "Captain", 24));
            dotaCharactersClass.AddTeacher(new Teacher("Mortred", "Phantom assassin", 24));
            dotaCharactersClass.AddTeacher(new Teacher("Pudge", "Butcher", 24));
            dotaCharactersClass.AddTeacher(new Teacher("Mirana", "Priestess of the moon", 23));

            TelerikSchool.AddClass(new SchoolClass());
            TelerikSchool.AddClass(telerikClass);
            TelerikSchool.AddClass(writersClass);
            TelerikSchool.AddClass(dotaCharactersClass);

            Console.WriteLine(TelerikSchool);

            
        }
Exemplo n.º 20
0
        static void Main()
        {
            School TelerikSchool = new School("Telerik");

            SchoolClass telerikClass        = new SchoolClass();
            SchoolClass writersClass        = new SchoolClass();
            SchoolClass dotaCharactersClass = new SchoolClass();

            telerikClass.AddStudent(new Student("Svetlin", "Nakov", 30));
            telerikClass.AddStudent(new Student("Doncho", "Minkov", 25));
            telerikClass.AddStudent(new Student("Nikolay", "Kostov", 23));
            telerikClass.AddStudent(new Student("George", "Georgiev", 22));
            telerikClass.AddTeacher(new Teacher("Pavel", "Kolev", 24));
            telerikClass.AddTeacher(new Teacher("Mihail", "Petrov", 23));
            telerikClass.AddTeacher(new Teacher("Lyubomir", "Yanchev", 18));

            writersClass.AddStudent(new Student("Ivan", "Vazov", 23));
            writersClass.AddStudent(new Student("Lyuben", "Karavelov", 22));
            writersClass.AddTeacher(new Teacher("Dimcho", "Debelqnov", 24));
            writersClass.AddTeacher(new Teacher("Nikola", "Vapcarov", 23));

            dotaCharactersClass.AddStudent(new Student("Tinker", "Bouch", 22));
            dotaCharactersClass.AddStudent(new Student("Spectre", "Mercurial", 22));
            dotaCharactersClass.AddStudent(new Student("Alleria", "Windrunner", 22));
            dotaCharactersClass.AddStudent(new Student("Drow", "Ranger", 22));
            dotaCharactersClass.AddTeacher(new Teacher("Zeus", "Lord of olympia", 24));
            dotaCharactersClass.AddTeacher(new Teacher("Kunka", "Captain", 24));
            dotaCharactersClass.AddTeacher(new Teacher("Mortred", "Phantom assassin", 24));
            dotaCharactersClass.AddTeacher(new Teacher("Pudge", "Butcher", 24));
            dotaCharactersClass.AddTeacher(new Teacher("Mirana", "Priestess of the moon", 23));

            TelerikSchool.AddClass(new SchoolClass());
            TelerikSchool.AddClass(telerikClass);
            TelerikSchool.AddClass(writersClass);
            TelerikSchool.AddClass(dotaCharactersClass);

            Console.WriteLine(TelerikSchool);
        }
        static void Main(string[] args)
        {
            Student mitko = new Student("Dimitar", "201401#17", "Dimitar likes physics.");
            Student alex  = new Student("Alex", "201401#01");
            //Student radi = new Student("Radostina", "201401#01"); // this row throw exception because the ID is busy
            Student gosho  = new Student("Georgi", "201402#20", "Georgi hates math.");
            Student dancho = new Student("Yordan", "201402#27", "Dancho hates english.");

            Discipline physics = new Discipline("Physics", new List <Student>()
            {
                mitko, alex, dancho
            }, 20,
                                                "Physics is one of the oldest academic disciplines");
            Discipline maths = new Discipline("Math", new List <Student>()
            {
                alex, gosho, dancho
            }, 17);
            Discipline english = new Discipline("English language", new List <Student>()
            {
                dancho, mitko, gosho
            }, 35);
            Discipline bulgarian = new Discipline("Bulgarian language", new List <Student>()
            {
                dancho, alex, gosho
            }, 55);


            Teacher rumi = new Teacher("Rumelina", new List <Discipline>()
            {
                bulgarian
            }, "The worst teacher in the world!");
            Teacher svetlio = new Teacher("Svetlozar", new List <Discipline>()
            {
                physics, maths
            }, "The best teacher in the school!");
            Teacher alexandrina = new Teacher("Alexandrina", new List <Discipline>()
            {
                english
            });

            SchoolClass class201401 = new SchoolClass("201401", new List <Student>()
            {
                alex, mitko
            }, new List <Teacher>()
            {
                rumi, svetlio
            },
                                                      "class201401 is awesome!");
            //SchoolClass class201401dublicate = new SchoolClass("201401", new List<Student>() { alex, mitko }, new List<Teacher>() { rumi, svetlio },
            //    "class201401 is awesome!"); // this 2 rows throw exception because the uniqueID is busy
            SchoolClass class201402 = new SchoolClass("201402", new List <Student>()
            {
                gosho, dancho
            },
                                                      new List <Teacher>()
            {
                rumi, svetlio, alexandrina
            });

            School mg = new School(new List <SchoolClass>()
            {
                class201401, class201402
            });
        }
Exemplo n.º 22
0
 public void RemoveClass(SchoolClass schoolClass)
 {
     this.classes.Remove(schoolClass);
 }
Exemplo n.º 23
0
 //methods
 public void AddClass(SchoolClass schoolClass)
 {
     this.classes.Add(schoolClass);
 }
Exemplo n.º 24
0
 public void AddClass(SchoolClass schoolClass)
 {
     this.SchoolClass.Add(schoolClass);
 }
Exemplo n.º 25
0
 public void RemoveClass(SchoolClass c)
 {
     this.classes.Remove(c);
 }
Exemplo n.º 26
0
 public void AddClass(SchoolClass c)
 {
     this.classes.Add(c);
 }
Exemplo n.º 27
0
 public void RemoveClass(SchoolClass c)
 {
     this.classes.Remove(c);
 }
Exemplo n.º 28
0
 public void AddClass(SchoolClass c)
 {
     this.classes.Add(c);
 }
Exemplo n.º 29
0
 public void RemoveClass(SchoolClass schoolClass)
 {
     this.classes.Remove(schoolClass);
 }
Exemplo n.º 30
0
 public void DeleteSchoolClass(SchoolClass schoolClass)
 {
     this.schoolClasses.Remove(schoolClass);
 }