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 }); }
public void AddDiscipline(Discipline discipline) { bool isAllreadyTeached = this.disciplines.Count(x => x.Name == discipline.Name) == 0; if (!isAllreadyTeached) { this.disciplines.Add(discipline); } }
// Add Discipline in the list public void AddDiscipline(Discipline discipline) { if (discipline == null) { throw new ArgumentNullException("Discipline parameter is Null!"); } this.disciplinesList.Add(discipline); }
public void RemoveDiscipline(Discipline discipline) { if (this.disciplines.Remove(discipline)) { Console.WriteLine("{0} removed from teacher {1}!", discipline.Name, this.Name); } else { Console.WriteLine("Teacher {0} doesn't have the discipline {1}!", this.Name, discipline.Name); } }
//methods public void AddDiscipline(Discipline discipline) { //if the teacher does not have the discipline, add it, else skip it if (!this.Disciplines.Contains(discipline)) { this.disciplines.Add(discipline); Console.WriteLine("{0} added to teacher {1}!", discipline.Name, this.Name); } else { Console.WriteLine("Teacher {0} already has {0} included!", this.Name, discipline.Name); } }
// Remove Discipline from the list public bool RemoveDiscipline(Discipline discipline) { if (discipline == null) { throw new ArgumentNullException("Discipline parameter is Null!"); } if (!this.disciplinesList.Contains(discipline)) { return false; } return this.disciplinesList.Remove(discipline); }
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); }
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(); }
public void RemoveDiscipline(Discipline discipline) { this.disciplines.Remove(discipline); }
public void AddDiscipline(Discipline discipline) { this.disciplines.Add(discipline); }
public void RemoveDiscipline(Discipline discipline) { this.disciplines.RemoveAll(x => x.Name == discipline.Name); }
public void RemoveDiscipline(Discipline discipline) { this.Disciplines.Remove(discipline); }
public void AddDiscipline(Discipline discipline) { this.Disciplines.Add(discipline); }
public Teacher(string name, Discipline discipline, string details = null) : this(name, new List <Discipline> { discipline }, details) { }
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 Teacher(string name , Discipline discipline) { this.Name = name; this.DisciplineSet = new List<Discipline>(); this.DisciplineSet.Add(discipline); }