static void Main() { Teacher tomas = new Teacher("Tomas", "Fernandes"); tomas.Disciplines.Add(new SchoolDiscipline(Subject.Calculus, 30, 45)); Class firstA = new Class("1a"); firstA.AddStudent(new Student("ivan", "ivanoq", 12)); firstA.AddStudent(new Student("iwan", "ivanqv", 15)); firstA.AddStudent(new Student("ivrn", "ivaeov", 2)); firstA.AddStudent(new Student("ivat", "ivynov", 22)); firstA.AddStudent(new Student("yvan", "itanov", 35)); firstA.AddStudent(new Student("eqan", "iranov", 5)); firstA.AddStudent(new Student("vern", "evanov", 1)); Console.Write("ShowStudent() method: "); firstA.ShowStudent(15); SchoolDiscipline biology = new SchoolDiscipline(Subject.Biology, 30, 30); firstA.AddTeacher(tomas); firstA.AddTeacher(new Teacher("Tom", "Ferandes", Subject.Algebra)); firstA.AddTeacher(new Teacher("Tas", "Fernades", biology)); firstA.AddTeacher(new Teacher("Tos", "Fernand")); firstA.AddTeacher(new Teacher("Toms", "Fendes")); firstA.AddTeacher(new Teacher("Toas", "Fende")); Console.Write("ShowTeacher() method: "); firstA.ShowTeacher(biology); Console.WriteLine("ToString() method for class: "); Console.WriteLine(firstA); }
public Teacher(string firstName, string lastName, SchoolDiscipline schoolDiscipline) : this(firstName, lastName) { this.Disciplines.Add(schoolDiscipline); }
public void ShowTeacher(SchoolDiscipline discipline) { Teacher teacher = this.Teachers[this.Teachers.FindIndex(x => x.Disciplines.Contains(discipline))]; Console.WriteLine(teacher); }