//01. We are given a school. In the school there are //classes of students. Each class has a set of teachers. //Each teacher teaches a set of disciplines. Students have //name and unique class number. Classes have unique text identifier. //Teachers have name. Disciplines have name, number of lectures and //number of exercises. Both teachers and students are people. Students, //classes, teachers and disciplines could have optional comments (free text block). //Your task is to identify the classes (in terms of OOP) and their attributes //and operations, encapsulate their fields, define the class hierarchy and create //a class diagram with Visual Studio. static void Main() { School PMG = new School("PMG"); ClassOfStudents _11a = new ClassOfStudents("11 A"); Student pesho = new Student("Pesho", 1); Student gosho = new Student("Gosho", 2); _11a.AddStudent(pesho); _11a.AddStudent(gosho); Discipline math = new Discipline("Mathematics", 5, 10); Discipline physics = new Discipline("Physics", 5, 15); Teacher rangelova = new Teacher("Rangelova"); rangelova.AddComment("Az imam kozi"); rangelova.AddDiscipline(math); rangelova.AddDiscipline(physics); _11a.AddStudent(pesho); _11a.AddStudent(gosho); _11a.AddTeacher(rangelova); PMG.AddClass(_11a); }
static void Main(string[] args) { School someSchool = new School("Ivan Vazov"); ClassOfStudents _8b = new ClassOfStudents("8 B"); Students ivan = new Students("Ivan", 10); Students mitko = new Students("Mitko", 15); Students petko = new Students("Petko", 20); _8b.AddStudent(ivan); _8b.AddStudent(mitko); _8b.AddStudent(petko); ivan.AddComment("Iskam 6 !"); Disciplines literature = new Disciplines("Literature", 20, 10); Disciplines journalism = new Disciplines("Journalism", 30, 40); Teachers vuchkov = new Teachers("Profesor Vuchkov"); vuchkov.AddComment("Gledam i ne vqrvam na ushite si !"); vuchkov.AddDiscipline(literature); vuchkov.AddDiscipline(journalism); _8b.AddTeacher(vuchkov); someSchool.AddClass(_8b); Console.WriteLine("Class number of {0} is : {1}", petko.Name, petko.ClassNumber); foreach (var item in vuchkov.OptionalComments) { Console.WriteLine("Professor Vuchkov declared : {0}", item); } Console.WriteLine(); Console.WriteLine("He teaches the following disciplines : "); foreach (var item in vuchkov.Disciplines) { Console.WriteLine(item.NameOfLecture); } }
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"); }
public void RemoveClass(ClassOfStudents classToRemove) { this.schoolClasses.Remove(classToRemove); }
public void AddClass(ClassOfStudents classToAdd) { this.schoolClasses.Add(classToAdd); }
public void RemoveClassOfStudents(ClassOfStudents StudentClassToRemove) { studentClasses.Remove(StudentClassToRemove); Console.WriteLine(""); Console.WriteLine("asdsadass"); }
public void AddClassOfStudents(ClassOfStudents newStudentClass) { studentClasses.Add(newStudentClass); }
//remove class public void RemoveClass(ClassOfStudents @class) { this.classes.Remove(@class); }
//add class public void AddClass(ClassOfStudents @class) { this.classes.Add(@class); }