public void AddDiscipline(Discipline discipline) { if (this.disciplines.Count(x => x.Name == discipline.Name) == 0) { this.disciplines.Add(discipline); } }
public Teacher(string firstName, string lastName, Discipline disc, string comment) : base(firstName, lastName) { disciplines = new List<Discipline>(); disciplines.Add(disc); commentOfTeacher = comment; }
static void Main() { School justSchool = new School("JustSchool"); Teacher ivanov = new Teacher("Ivanov"); Teacher metodiev = new Teacher("Metodiev"); Student milko = new Student("Milko", 15); Student vasil = new Student("Vasil", 2); Class bClass = new Class("BClass"); Discipline math = new Discipline("Math", 5, 10); Discipline chemistry = new Discipline("Chemistry", 5, 12); justSchool.Classes.Add(bClass); bClass.Students.Add(milko); bClass.Students.Add(vasil); bClass.Teachers.Add(ivanov); bClass.Teachers.Add(metodiev); ivanov.Disciplines.Add(math); metodiev.Disciplines.Add(chemistry); bClass.Comment = "Pros"; }
static void Main(string[] args) { Student studentOne = new Student("Ivan", "Dvoikadjiq", 1); Student studentTwo = new Student("Maria", "Otlichnik", 2); Student studentThree = new Student("Ana", 3); IList<Student> students = new List<Student>(); students.Add(studentOne); students.Add(studentTwo); students.Add(studentThree); Discipline disciplineOne = new Discipline("Matematika", 12, students, "muka"); Discipline disciplineTwo = new Discipline("Muzika", 12, students); IList<Discipline> disciplines = new List<Discipline>(); disciplines.Add(disciplineOne); disciplines.Add(disciplineTwo); Teacher teacherOne = new Teacher("Petko", disciplines); IList<Teacher> teachers = new List<Teacher>(); teachers.Add(teacherOne); Class classOne = new Class("Detska gradina", students, teachers); Console.WriteLine(classOne); }
public static void Main() { try { School softUni = new School("SoftUni"); Student student1 = new Student("Test1", "a123", "some details"); Student student2 = new Student("Test2", "a12"); Discipline discipline = new Discipline("PHP", 10, "Enter details here"); discipline.AddStudents(student1, student2); Teacher teacher = new Teacher("Angel", "Teacher details"); teacher.AddDisciplines(discipline, discipline, discipline); Class classB1 = new Class("B1", "This is class details."); classB1.AddStudents(student1, student2); classB1.AddTeachers(teacher); softUni.AddClasses(classB1); Console.WriteLine(softUni); } catch (ArgumentException ex) { Console.WriteLine(ex.Message); } }
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); }
//a method for creating a new test school with predifined details //only the students are random picked ->check CreatArray method in Student class public static School New() { //create two student list with random details List<Student> exampleStudents1 = Student.CreateArray(10); List<Student> exampleStudents2 = Student.CreateArray(10); //create several disciplines with their names, lecture hours and exercies hours Discipline chemistry = new Discipline("Chemistry", 3, 3); Discipline history = new Discipline("History", 2, 2); Discipline mathematics = new Discipline("Mathematics", 4, 4); Discipline sport = new Discipline("Sport", 5, 5); //create list of disciplines for one of the teachers List<Discipline> exampleTeacher1Disciplines = new List<Discipline>(); exampleTeacher1Disciplines.Add(chemistry); exampleTeacher1Disciplines.Add(mathematics); //create list of disciplines for the other teacher List<Discipline> exampleTeacher2Disciplines = new List<Discipline>(); exampleTeacher2Disciplines.Add(history); exampleTeacher2Disciplines.Add(sport); //create two teachers and assign one list of disciplines to each of them Teacher exampleTeacher1 = new Teacher("Blagoy Stankov", exampleTeacher1Disciplines); Teacher exampleTeacher2 = new Teacher("Todor Trendafilov", exampleTeacher2Disciplines); //create a new class and add students and teacher to the class Class a12 = new Class("12a"); a12.AddGroupStudents(exampleStudents1); a12.AddTeacher(exampleTeacher1); //create another class and add students and teacher to the class Class b12 = new Class("12b"); b12.AddGroupStudents(exampleStudents2); b12.AddTeacher(exampleTeacher2); //create a new school School exampleSchool = new School("SOU Petko Rachov Slaveikov"); //assign both classes to the school exampleSchool.AddClass(a12); exampleSchool.AddClass(b12); return exampleSchool; }
internal static void Main() { Student ivan = new Student("Ivan", 1001); Student georgi = new Student("Georgi", 1002, "good man"); Student vasil = new Student("Vasil", 1003, "bad man"); List<Student> students = new List<Student>() { ivan, georgi, vasil }; Discipline math = new Discipline("Math", 150, students); Discipline phisics = new Discipline("Physics", 100, students, "Base"); List<Discipline> disciplines = new List<Discipline>() { math, phisics }; Teacher ivanov = new Teacher("Ivanov", disciplines, "teacher"); Teacher nakov = new Teacher("Nakov", disciplines, "inspirator"); List<Teacher> teachers = new List<Teacher>() { ivanov, nakov }; List<Teacher> inspirators = new List<Teacher>() { nakov }; ClassOfStudents groupA = new ClassOfStudents("Group A", teachers, "good class"); ClassOfStudents groupB = new ClassOfStudents("Group B", inspirators, "bad class"); }
static void Main(string[] args) { Student student1 = new Student("Kiril", 13); student1.AddComment("Test comment1 for student 1"); student1.AddComment("Test comment2 for student 1"); Student student2 = new Student("Vasil", 25); student2.AddComment("Test comment1 for student 2"); student2.AddComment("Test comment2 for student 2"); student1.RemoveComment("Test comment1 for student 1"); student1.DisplayComments(); student2.ClearComments(); student2.DisplayComments(); student1.AddComment("Blah blah"); Console.WriteLine(student1.CommentsCount); student1.RemoveCommentAt(0); student1.DisplayComments(); Discipline discipline1 = new Discipline("Discrete Mathematics", 1, 1); Discipline discipline2 = new Discipline("Mathematical Analysis", 1, 1); Discipline discipline3 = new Discipline("OOP", 2, 3); discipline1.AddComment("Introduction do discrete data structures."); discipline3.AddComment("Object Oriented Programming in C#"); Teacher teacher1 = new Teacher("Trifon", new List<Discipline>() { discipline1 }); Teacher teacher2 = new Teacher("Grigor", new List<Discipline>() { discipline2, discipline3 }); Class class1 = new Class("312", new List<Teacher>() { teacher1, teacher2} , new List<Student>() { student1, student2} ); School school = new School(new List<Class>() { class1 }); }
static void Main() { List<Student> students = new List<Student> { new Student("Gosho", 1), new Student("Pesho", 3), new Student("Tosho", 2), new Student("Ivan", 4), new Student("Gergana", 5) }; var html = new Discipline("HTML", 1); html.AddStudent(students[0]); html.AddStudent(students[2]); html.AddStudent(students[4]); html.Ditails = "Fast-Track"; var css = new Discipline("CSS", 2); css.AddStudent(students[0]); css.AddStudent(students[1]); css.AddStudent(students[2]); var csharp = new Discipline("C#", 3); csharp.AddStudent(students[1]); csharp.AddStudent(students[3]); csharp.AddStudent(students[4]); var javaScript = new Discipline("JavaScript", 4, students); var cSharpTeacher = new Teacher("Svetlin Nakov"); cSharpTeacher.AddDiscipline(csharp); var webFundamentalsTeacher = new Teacher("Vladimir Georgiev"); webFundamentalsTeacher.AddDiscipline(html); webFundamentalsTeacher.AddDiscipline(css); var classA = new Class("A", new List<Teacher> { cSharpTeacher, webFundamentalsTeacher }); Console.WriteLine(classA.ToString()); }
public static void Main() { Student st1 = new Student("Pesho", "0102030405"); Student st2 = new Student("Kiro", "0102020304"); Student st3 = new Student("Penka", "0102020304"); st1.Details = "Golem pich"; Console.WriteLine(st1); Console.WriteLine(); Discipline oop = new Discipline("OOP", 12); oop.AddStudent(st1); oop.AddStudent(st2); oop.Students.Add(st3); //will not work - you have to use the method AddStudent Discipline java = new Discipline("Java", 6); java.AddStudent(st3); //Console.WriteLine(st1.Details); Console.WriteLine(oop); Console.WriteLine(java); Console.WriteLine(); Teacher t1 = new Teacher("Bai Ivan"); t1.AddDiscipline(oop); t1.AddDiscipline(java); t1.Details = "Naj-dobriq daskal!"; Console.WriteLine(t1); Console.WriteLine(); Class cl1 = new Class("Alpha"); cl1.AddTeacher(t1); cl1.AddStudent(st1); cl1.AddStudent(st2); cl1.AddStudent(st3); Console.WriteLine(cl1); }
static void Main() { Student student1 = new Student("Ivan", 15); Student student2 = new Student("Petkan", 17); Student student3 = new Student("Dragan", 19); Class osmiB = new Class("osmi B"); osmiB.SetOfStudents.Add(student1); osmiB.SetOfStudents.Add(student2); osmiB.SetOfStudents.Add(student3); Teacher teacher1 = new Teacher("Anatoli"); Teacher teacher2 = new Teacher("Cvetkan"); osmiB.SetOfTeachers.Add(teacher1); osmiB.SetOfTeachers.Add(teacher2); Discipline math = new Discipline("Math", 5, 4); Discipline history = new Discipline("History", 9, 8); Discipline geography = new Discipline("Geography", 4, 9); Discipline science = new Discipline("Science", 5, 4); teacher1.SetOfDisciplines.Add(math); teacher1.SetOfDisciplines.Add(history); teacher2.SetOfDisciplines.Add(geography); teacher2.SetOfDisciplines.Add(science); Console.WriteLine("The class {0} has those students : \n",osmiB.UnicTxtInd); Console.WriteLine(osmiB.StudentToString()); Console.WriteLine("Some teachers:"); Console.WriteLine(osmiB.TeacherToString()); teacher1.AddComment("This is some optional comment"); string comment=teacher1.ShowComment(); Console.WriteLine(comment); }
static void Main() { Student stdFirst = new Student("Snejko", 12); Student stdSecond = new Student("Bai Spiro", 1); Student stdThird = new Student("Kashchei Bezsmurtni", 99); Discipline disciplFirst = new Discipline("Combene na jenki", 1, 1); Discipline disciplSecond = new Discipline("Grebane s lujica", 10, 10); Discipline disciplThird = new Discipline("Sky Diving", 10, 0); List<Discipline> bobTheTurboObjects = new List<Discipline>(); bobTheTurboObjects.Add(disciplFirst); bobTheTurboObjects.Add(disciplSecond); bobTheTurboObjects.Add(disciplThird); Teacher teacherFirst = new Teacher("Bobi Turboto", bobTheTurboObjects); Console.WriteLine("The only one teacher in the school is: " + teacherFirst.TeacherName + ". Imagine what kind of school is that !"); Console.WriteLine("Bobi Turboto lectures students on these disciplines: "); foreach (Discipline discipline in teacherFirst.TeacherObjects) { Console.WriteLine(); Console.WriteLine(discipline.ObjectName); } }
public static void Main(string[] args) { var pesho = new Student("Pesho", "201411V21", "very tallented, self-critical"); var misho = new Student("Misho", "201411V13"); // Student gatyo = new Student("Gosho", "201411V13"); // should throw exception var gosho = new Student("Gosho", "201412V13"); var katya = new Student("Katya", "201412V19", "likes litterature, expecially indian novels of Karl May"); var maths = new Discipline("Mathematics", 35, new List<Student>() { pesho, gosho, misho }); var litterature = new Discipline("Litterature", 15, new List<Student>() { gosho, misho, katya }, "optional"); var informatics = new Discipline("Informatics", 50, new List<Student>() { pesho, gosho, katya, misho }, "main discipline"); var peshova = new Teacher("Peshova", new List<Discipline>() { litterature }); var dushkov = new Teacher("Dushkov", new List<Discipline>() { maths, informatics }); var class201411V = new Class("201411V", new List<Student>() { pesho, misho }, new List<Teacher>() { peshova }); // below row should throw exception // SchoolClass class201412 = new Class("201411V", new List<Student>() { }, new List<Teacher>() { peshova, dushkov }); var class201412V = new Class("201412V", new List<Student>() { }, new List<Teacher>() { peshova, dushkov }); var eg = new School(new List<Class>() { class201411V, class201412V }); }
public void AddDiscipline( Discipline disc) { this.teachersDisciplines.Add(disc); }
public void RemoveDiscipline(Discipline d) { this.disciplines.Remove(d); }
public void RemoveDiscipline(string disciplineName) { Discipline discipline = new Discipline(disciplineName); disciplinesOfTeacher.Remove(discipline); }
public void RemoveTeacher(string name, Discipline[] disciplines) { Teacher teacher = new Teacher(name, disciplines); teachers.Remove(teacher); }
public void AddDiscipline(Discipline discipline) { this.disciplines.Add(discipline); }
//remove disciplines to the teacher public void RemoveDiscipline(Discipline discipline) { this.setOfDisciplines.Remove(discipline); }
private static void Main() { List<Student> students = new List<Student> { new Student("Ivan", "11"), new Student("Boril", "11"), new Student("Hristo", "11"), new Student("Svetla", "21"), new Student("Joro", "21"), new Student("Elena", "21"), new Student("Mira", "31"), new Student("Stoil", "31"), new Student("Todor", "31"), new Student("Draan", "12"), new Student("Pesho", "12"), new Student("Gosho", "12"), new Student("Mariela", "22"), new Student("Jordan", "22"), new Student("Ginka", "22"), new Student("Sneja", "32"), new Student("Stamat", "32"), new Student("Todor", "32") }; Console.WriteLine("Student Objects :"); students.ForEach(x => Console.WriteLine("{0} {1}", x.Name, x.ClassNumb)); Console.WriteLine(); List<Discipline> disciplines = new List<Discipline>() { new Discipline("PHP basics", 10, students.FindAll(student => student.ClassNumb.Equals("11"))), new Discipline("JavaScript basics", 10, students.FindAll(student => student.ClassNumb.Equals("21"))), new Discipline("C# basics", 10, students.FindAll(student => student.ClassNumb.Equals("31"))), new Discipline("JavaScript OOP", 10, students.FindAll(student => student.ClassNumb.Equals("12"))), new Discipline("PHP OOP", 10, students.FindAll(student => student.ClassNumb.Equals("22"))), new Discipline("C# OOP", 10, students.FindAll(student => student.ClassNumb.Equals("32"))) }; Discipline phpBasics = new Discipline("PHP basics", 10, students.FindAll(student => student.ClassNumb.Equals("11"))); Discipline javaScriptBasics = new Discipline("JavaScript basics", 10, students.FindAll(student => student.ClassNumb.Equals("21"))); Discipline cSharpBasics = new Discipline("C# basics", 10, students.FindAll(student => student.ClassNumb.Equals("31"))); Discipline javaScriptOop = new Discipline("JavaScript OOP", 10, students.FindAll(student => student.ClassNumb.Equals("12"))); Discipline phpOop = new Discipline("PHP OOP", 10, students.FindAll(student => student.ClassNumb.Equals("22"))); Discipline cSharpOop = new Discipline("C# OOP", 10, students.FindAll(student => student.ClassNumb.Equals("32"))); Console.WriteLine("Discipline Objects :"); disciplines.ForEach(disc => disc.DisciplineStudents.ForEach(student => Console.WriteLine("{0} {1}", disc.DisciplineName, student.Name))); Console.WriteLine(); List<Teacher> teachers = new List<Teacher> { new Teacher("Gospodinov", new List<Discipline>() { phpBasics, javaScriptBasics }), new Teacher("Draganov", new List<Discipline>(){ cSharpBasics, cSharpOop}), new Teacher("Chervenkov", new List<Discipline>(){ phpOop, javaScriptBasics}), new Teacher("Sharanov", new List<Discipline>(){ javaScriptOop, cSharpBasics}) }; Teacher gospodinov = new Teacher("Gospodinov", new List<Discipline>() { phpBasics, javaScriptBasics }); Teacher draganov = new Teacher("Draganov", new List<Discipline>(){ cSharpBasics, cSharpOop}); Teacher chervenkov = new Teacher("Chervenkov", new List<Discipline>(){ phpOop, javaScriptBasics}); Teacher sharanov = new Teacher("Sharanov", new List<Discipline>(){ javaScriptOop, cSharpBasics}); List<Class> classes = new List<Class> { new Class("A1", teachers.Where(teacher => teacher.Disciplines.Any(disc => disc.DisciplineName.EndsWith("basics"))).ToList()), new Class("A2", teachers.Where(teacher => teacher.Disciplines.Any(disc => disc.DisciplineName.EndsWith("OOP"))).ToList()) }; Console.WriteLine("Class Objects : "); classes.ForEach(clas => clas.ClassTeachers .ForEach(teacher => teacher.Disciplines .ForEach(discipline => Console.WriteLine("{0} - {1} : {2}", clas.ClassIndentifier, teacher.Name, discipline.DisciplineName)))); }
public void RemoveDiscipline(Discipline discipline) { this.Disciplines.Remove(discipline); }
public void AddTeacher(string name, Discipline[] disciplines) { Teacher teacher = new Teacher(name, disciplines); teachers.Add(teacher); }
static void Main(string[] args) { School penchoSlaveikov = new School("Pencho Slaveikov"); Class mathClass = new Class("12A"); penchoSlaveikov.AddClass(mathClass); Class artClass = new Class("12B"); penchoSlaveikov.AddClass(artClass); #region All Students Student[] students = { new Student("Pesho", 1), new Student("Minka", 2), new Student("Goshko", 3), new Student("Stavri", 4), new Student("Penka", 5), new Student("Slavka", 6), new Student("Dimcho", 7), new Student("Pencho", 8), new Student("Simo", 9), new Student("Giga", 10), new Student("Aishe", 11), }; #endregion #region All Disciplines Discipline mathematics = new Discipline("Mathematics", 3, 10); Discipline physics = new Discipline("Physics", 5, 15); Discipline geography = new Discipline("Geography", 2, 8); Discipline music = new Discipline("Music", 3, 6); Discipline english = new Discipline("English", 6, 12); Discipline drawing = new Discipline("Drawing", 2, 4); Discipline chemistry = new Discipline("Chemistry", 4, 8); #endregion #region All Teachers List<Teacher> teachers = new List<Teacher>() { new Teacher("Georgiev"), new Teacher("Minkov"), new Teacher("Ivanov"), new Teacher("Panaiotoa"), new Teacher("Ignatova") }; #endregion teachers[0].AddDiscipline(mathematics); teachers[0].AddDiscipline(physics); teachers[1].AddDiscipline(chemistry); teachers[1].AddDiscipline(physics); teachers[2].AddDiscipline(english); teachers[3].AddDiscipline(geography); teachers[4].AddDiscipline(music); teachers[4].AddDiscipline(drawing); mathClass.AddStudents(new List<Student>() { students[0], students[1], students[2], students[3], students[4], students[5] }); artClass.AddStudents(new List<Student>() { students[6], students[7], students[8], students[9], students[10] }); mathClass.AddTeachers(new List<Teacher>() { teachers[0], teachers[1], teachers[2] }); artClass.AddTeachers(new List<Teacher>() { teachers[2], teachers[3], teachers[4] }); #region Print on console Console.WriteLine("School: " + penchoSlaveikov); Console.Write("Classes: "); foreach (var clas in penchoSlaveikov.Classes) { Console.Write(clas + " "); } Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Teachers in " + mathClass.UniqueId + ":"); foreach (var teacher in mathClass.Teachers) { Console.WriteLine(teacher + " - teaches: " + teacher.Disciplines); } Console.WriteLine(); Console.WriteLine("Teachers in " + artClass.UniqueId + ":"); foreach (var teacher in artClass.Teachers) { Console.WriteLine(teacher + " - teaches: " + teacher.Disciplines); } Console.WriteLine(); Console.WriteLine("Students in " + mathClass.UniqueId + ":"); foreach (var student in mathClass.Students) { Console.WriteLine(student); } Console.WriteLine(); Console.WriteLine("Students in " + artClass.UniqueId + ":"); foreach (var student in artClass.Students) { Console.WriteLine(student); } #endregion }
public void RemoveDiscipline(Discipline disc) { disciplines.Remove(disc); }
public void AddDiscipline(Discipline disc) { disciplines.Add(disc); }
public void RemoveDiscipline(Discipline discipline) { this.disciplines.RemoveAll(x => x.Name == discipline.Name); }
public void AddDisicipline(Discipline newDiscipline) { this.listOfDisciplines.Add(newDiscipline); }
public void DeleteDiscipline(Discipline discipline) { this.disciplines.Remove(discipline); }
public Teacher(string name, Discipline discipline, string comment = "") : base(name) { this.Comment = comment; this.Disc = discipline; }
//constructors public Teacher(string name, Discipline[] disciplinesOfTeacher) : base(name) { this.disciplinesOfTeacher = new List<Discipline>(disciplinesOfTeacher); this.comments = new List<string>(); }
public Teacher(string firstName, string lastName, char sex, DateTime birthDate, Discipline[] disciplines) : base(firstName, lastName, sex, birthDate) { this.Disciplines = new List<Discipline>(disciplines); }
public void AddDiscipline(string disciplineName,byte numberOfLectutes, byte numberOfExercises) { Discipline discipline = new Discipline(disciplineName, numberOfLectutes, numberOfExercises); disciplinesOfTeacher.Add(discipline); }
// methods public void AddDiscipline(Discipline dsc) { this.teachersDisciplines.Add(dsc); }