示例#1
0
        static void Main()
        {
            Student goshkoStudent = new Student("Goshko", 5);
            goshkoStudent.AddComment("Goshko is a bad student.");

            Student peshoStudent = new Student("Pesho", 10);
            peshoStudent.AddComment("Pesho is a normal student.");

            Student ivanStudent = new Student("Ivan", 11);
            ivanStudent.AddComment("Ivan is a great student.");

            Discipline maths = new Discipline("Maths", 10, 10);
            Discipline physics = new Discipline("Physics", 5, 4);

            Teacher teacher = new Teacher("Borislav Petrov", new List<Discipline>() { maths, physics });
            teacher.AddComment("Borislav Petrov is a very good teacher.");
            teacher.AddComment("Wonderful teacher.");
            teacher.AddComment("Teaches only useful and interesting things.");

            //test comments methods
            teacher.ShowComments();
            Console.WriteLine();

            teacher.RemoveComment("Wonderful teacher.");
            //the comments after removed one comment
            teacher.ShowComments();

            //clear all comments and after that nothing happens
            teacher.ClearAllComments();
            teacher.ShowComments();

            Class newClass = new Class("123", new List<Teacher>() { teacher }, new List<Student>() { goshkoStudent, peshoStudent, ivanStudent });

            School school = new School(new List<Class>() { newClass });
        }
示例#2
0
        static void Main()
        {
            //instantiate class
            SchoolClass schoolClass = new SchoolClass("1234");
            //add students
            schoolClass.AddStudent(new Student("Mariana Dimitrova", "20"));
            schoolClass.AddStudent(new Student("Ivan Ivanov", "21"));
            schoolClass.AddStudent(new Student("Maria Ivanova", "22"));
            schoolClass.AddStudent(new Student("Dimitur Dimitrov", "23"));
            Console.WriteLine("--------------------------------");
            //add teachers
            Teacher one = new Teacher("Ms Ivanova");
            one.AddDiscipline(new Discipline("Biology", 30, 30));
            Teacher two = new Teacher("Ms Dimitrova");
            two.AddDiscipline(new Discipline("Geography", 30, 30));
            two.AddDiscipline(new Discipline("History", 30, 20));
            schoolClass.AddTeacher(one);
            schoolClass.AddTeacher(two);
            schoolClass.AddTeacher(one);
            Console.WriteLine("--------------------------");

            Console.WriteLine("------------------------");
            schoolClass.PrintStudents();
            Console.WriteLine("-----------------");
            schoolClass.PrintTeachers();
            Console.WriteLine("------------------");
            schoolClass.AddComment("comment");
            schoolClass.AddComment("second comment");
            Console.WriteLine("Comments of the class:");
            schoolClass.ViewComments();
        }
示例#3
0
        // Add Teacher in the list
        public void AddTeacher(Teacher teacher)
        {
            if (teacher == null)
            {
                throw new ArgumentNullException("Teacher parameter is Null!");
            }

            this.teacherList.Add(teacher);
        }
        static void Main()
        {

            #region CREATE TEST OBJ
            //discipline
            List<Disciplines> disciplines = new List<Disciplines>();
            disciplines.Add(new Disciplines("Chemistry", 4, 6));
            disciplines.Add(new Disciplines("Math", 10, 10));
            disciplines.Add (new Disciplines("Biology", 8, 6));
            disciplines.Add(new Disciplines("Insurance", 10, 6));
            disciplines.Add(new Disciplines("Informatics", 10, 16));

            //teachers

            List<Teacher> teachers = new List<Teacher>();
            teachers.Add(new Teacher("Manolov",disciplines.GetRange(3,1)));
            teachers.Add(new Teacher("Minkov",disciplines.GetRange(0,2)));
            teachers.Add(new Teacher("Marinov", disciplines.GetRange(2, 1)));
            teachers.Add(new Teacher("Ovcharov", disciplines.GetRange(0, 3)));
            
                         
            //students
            List<Student> students = new List<Student>();
            students.Add(new Student("Martin", 3));
            students.Add(new Student("Darin", 13));
            students.Add(new Student("Rumqna", 6));
            students.Add(new Student("Emil", 33));
            students.Add(new Student("Nikola", 7));
            students.Add(new Student("Georgi", 1));
            
            //SchoolClasses
            List<SchoolClass> schoolClasses = new List<SchoolClass>();
            schoolClasses.Add(new SchoolClass(teachers, students, "3133"));            
           
            //school
            School school = new School("School Akademy",schoolClasses);   
            #endregion

            //-----TEST SCHOOL-------
            Console.WriteLine(school);

            #region TEST OPTIONAL COMMENTS
            Student vasko = new Student("Vasko",3);
            vasko.FreeComments = "OPTIONAL COMMENT TEST";
            vasko.ShowFreeComments();

            Teacher ra = new Teacher("Vasko", disciplines);
            ra.FreeComments = "OPTIONAL COMMENT TEST";
            ra.ShowFreeComments();

            SchoolClass da = new SchoolClass(teachers,students,"31231");
            da.FreeComments = "OPTIONAL COMMENT TEST";
            da.ShowFreeComments();
            #endregion

        }
示例#5
0
 public void AddTeacher(Teacher teacher)
 {
     if (!this.Teachers.Contains(teacher))
     {
         this.Teachers.Add(teacher);
         Console.WriteLine("Teacher {0} added to class {1}!", teacher.Name, this.ID);
     }
     else
     {
         Console.WriteLine("Teacher {0} is already a member of the clas {1}!", teacher.Name, this.ID);
     }
 }
示例#6
0
        public void AddTeacher(Teacher teacher)
        {
            bool isInThisClass = this.teachers.Count(x => x.Name == teacher.Name) == 0;

            if (!isInThisClass)
            {
                this.teachers.Add(teacher);
            }
            else
            {
                Console.WriteLine("This teacher teaches this class.");
            }
        }
示例#7
0
        static void Main(string[] args)
        {
            School firstClass = new School();

            Teacher firstTeacher = new Teacher("Ivan");
            firstClass.AddTeacher(firstTeacher);

            Teacher secondTeacher = new Teacher("Stoian");
            firstClass.AddTeacher(secondTeacher);

            Teacher thirdTeacher = new Teacher("Dragan");
            firstClass.AddTeacher(thirdTeacher);

            foreach (var teacher in firstClass.Teachers)
            {
                teacher.Name = "test";
            }
        }
示例#8
0
        public static void Main()
        {
            Discipline firstDiscipline = new Discipline("history", 2, 5);
            Discipline secondDiscipline = new Discipline("math", 8, 4);

            Student firstStudent = new Student("Daniel", 1);
            Student secondStudent = new Student("Ivan", 2);

            Teacher firstTeacher = new Teacher("Petrov", new List<Discipline> { firstDiscipline, secondDiscipline });

            Class firstClass = new Class("1A", new List<Student> { firstStudent, secondStudent }, new List<Teacher> { firstTeacher });

            School firstSchool = new School(new List<Class> { firstClass });

            Console.WriteLine("The name of the first discipline of the first teacher in 1A class is: {0}",firstSchool.Classes[0].Teachers[0].SetOfDisciplines[0].Name);
            
            firstSchool.Classes[0].Comment = "The best students ever!";
            Console.WriteLine(firstSchool.Classes[0].Comment);
        }
示例#9
0
        public static void School()
        {
            //creating instances of Student class
            Student angel = new Student("Angel Dragomirov", 1);
            Student ivan = new Student("Ivan Dragomirov", 11);
            Student georgi = new Student("Georgi Haralampiev", 7);

            //creating instances of Teacher class
            Teacher petrov = new Teacher("Kiril Petrov");
            Teacher ivanov = new Teacher("Marian Ivanov");

            //Adding techers knowledge disciplines
            petrov.Subjects.Add(Discipline.Math);
            petrov.Subjects.Add(Discipline.Chemistry);

            ivanov.Subjects.Add(Discipline.AmericanEnglish);
            ivanov.Subjects.Add(Discipline.BritishEnglish);

            //creating instance of SchoolClass class
            SchoolClass AClass = new SchoolClass("AClass");

            //adding Students to the SchoolClass
            AClass.Students.Add(angel);
            AClass.Students.Add(ivan);
            AClass.Students.Add(georgi);

            //adding Teacher to the SchoolClass
            AClass.Teachers.Add(petrov);
            AClass.Teachers.Add(ivanov);

            //creating instance of School
            School mySchool = new School(51, "Elisaveta Bagryana");

            //adding SchoolClass to the School
            mySchool.Classes.Add(AClass);

            //adding optional comment
            AClass.About = "Geeks";
        }
        static void Main(string[] args)
        {
            Student pesho = new Student("Pesho",1234);
            Student mariika = new Student("Mariika",1235);
            mariika.Details = "Keep eyes on her, is very horny !";
            Discipline cSharp = new Discipline("C#",2,pesho,mariika);

            Teacher nakov = new Teacher("Svetlin Nakov",cSharp);
            Teacher vlado = new Teacher("Vlado Karamfilov", cSharp);

            Class firstLevel = new Class(nakov, "Level 2");

            IHuman[] allPeopleInSchool = new IHuman[] {  vlado, pesho, mariika, nakov};

            var sortedPpl = allPeopleInSchool.OrderBy(p => p.GetType() == typeof(Student)).ThenBy(p=>p.Name).ToList();

            //Console.WriteLine(mariika.Name +" Number "+ mariika.UniqueClassNumber +" Details: "+mariika.Details);
            foreach (var ppl in sortedPpl)
            {
                //Sorted By Teachers then Students
                Console.WriteLine(ppl.Name);
            }
            Console.WriteLine();
        }
示例#11
0
        // Remove Teacher from the list
        public bool RemoveTeacher(Teacher teacher)
        {
            if (teacher == null)
            {
                throw new ArgumentNullException("Teacher parameter is Null!");
            }

            if (!this.teacherList.Contains(teacher))
            {
                return false;
            }

            return this.teacherList.Remove(teacher);
        }
示例#12
0
 public void RemoveTeacher(Teacher oldTeacher)
 {
     this.teachers.Remove(oldTeacher);
 }
 public void RemoveTeacher(Teacher teacher)
 {
     this.teachers.Remove(teacher);
 }
示例#14
0
 public void RemoveTeacher(Teacher teacher)
 {
     if (this.Teachers.Contains(teacher))
     {
         this.Teachers.Remove(teacher);
         Console.WriteLine("Teacher {0} removed from class {1}", teacher.Name, this.ID);
     }
     else
     {
         Console.WriteLine("The teacher {0} does not teach the class {1}", teacher.Name, this.ID);
     }
 }
示例#15
0
文件: Test.cs 项目: KStoilkov/SoftUni
        public static void Main()
        {
            // Creating Students
            Student gosho  = new Student("Gosho", 123456);
            Student petko  = new Student("Petko", 432523, "Excellent grade");
            Student toshko = new Student("Toshko", 876981);
            Student kircho = new Student("Kircho", 987093);
            Student galq   = new Student("Galq", 654127);
            Student valq   = new Student("Valq", 986123);

            List <Student> listOfStudents1 = new List <Student> {
                gosho, petko
            };
            List <Student> listOfStudents2 = new List <Student> {
                toshko, kircho
            };
            List <Student> listOfStudents3 = new List <Student> {
                galq, valq
            };

            // Creating Disciplines
            Discipline csharp = new Discipline("C#", 8, listOfStudents1);
            Discipline js     = new Discipline("JavaScript", 6, listOfStudents2, "Amazing course");
            Discipline java   = new Discipline("Java", 9, listOfStudents3);

            List <Discipline> listOfDisciplines1 = new List <Discipline> {
                csharp, java
            };
            List <Discipline> listOfDisciplines2 = new List <Discipline> {
                csharp, js
            };
            List <Discipline> listOfDisciplines3 = new List <Discipline> {
                js, java
            };

            // Creating Teachers
            Teacher mitko = new Teacher("Mitko", listOfDisciplines1, "C# Master");
            Teacher pesho = new Teacher("Pesho", listOfDisciplines2);
            Teacher valio = new Teacher("Valio", listOfDisciplines3);

            List <Teacher> listOfTeachers1 = new List <Teacher> {
                mitko, pesho
            };
            List <Teacher> listOfTeachers2 = new List <Teacher> {
                valio, pesho
            };
            List <Teacher> listOfTeachers3 = new List <Teacher> {
                mitko, valio
            };

            // Creating Classes
            Class first  = new Class(listOfTeachers1, "Class 10a");
            Class second = new Class(listOfTeachers2, "Class 10b", "bad discipline");
            Class third  = new Class(listOfTeachers3, "Class 10c");

            List <Class> classes = new List <Class> {
                first, second, third
            };

            // Creating School
            School softSchool = new School(classes);

            Console.WriteLine(softSchool);
        }
 public Class(Teacher teacher, string name)
 {
     this.Name = name;
     this.TeacherSet = new List<Teacher>();
     this.TeacherSet.Add(teacher);
 }
示例#17
0
 public void RemoveTeacher(Teacher teacher)
 {
     this.teachers.RemoveAll(x => x.Name == teacher.Name);
 }
示例#18
0
 // for teachers
 public void AddTeacher(Teacher newTeacher)
 {
     this.teachers.Add(newTeacher);
 }
示例#19
0
文件: School.cs 项目: didimitrov/Algo
 public void AddTeacher(Teacher teacher)
 {
     this.Teachers.Add(teacher);
 }