static void Main() { //Students Student firstStudent = new Student("Pesho", "Kamburov", 1); Student secondStudent = new Student("Galin", "Imamov", 2); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Students:"); Console.ResetColor(); Console.WriteLine(firstStudent.ToString()); Console.WriteLine(secondStudent.ToString()); //Teachers Teacher firstTeacher = new Teacher("Stefan", "Popov"); firstTeacher.AddDiscipline(new Discipline("Math", 16, 10)); firstTeacher.AddDiscipline(new Discipline("Physics", 20, 5)); Teacher secondTeacher = new Teacher("Armin", "Van Buuren"); secondTeacher.AddDiscipline(new Discipline("TechMusic", 15, 5)); secondTeacher.AddDiscipline(new Discipline("Minimal", 18, 7)); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\nTeachers:"); Console.ResetColor(); Console.WriteLine(firstTeacher.ToString()); Console.WriteLine(secondTeacher.ToString()); //School School school = new School(); school.AddClass(new Class("12b", firstTeacher)); school.AddClass(new Class("12a", secondTeacher)); }
static void Main() { //Students Student firstStudent = new Student("Pesho", "Kamburov", 1); Student secondStudent = new Student("Galin", "Imamov", 2); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Students:"); Console.ResetColor(); Console.WriteLine(firstStudent.ToString()); Console.WriteLine(secondStudent.ToString()); //Teachers Teacher firstTeacher = new Teacher("Stefan", "Popov"); firstTeacher.AddDiscipline(new Discipline("Math", 16, 10)); firstTeacher.AddDiscipline(new Discipline("Physics", 20, 5)); Teacher secondTeacher = new Teacher("Armin", "Van Buuren"); secondTeacher.AddDiscipline(new Discipline("TechMusic", 15, 5)); secondTeacher.AddDiscipline(new Discipline("Minimal", 18, 7)); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\nTeachers:"); Console.ResetColor(); Console.WriteLine(firstTeacher.ToString()); Console.WriteLine(secondTeacher.ToString()); //School School school = new School(); school.AddClass(new Class("12b", firstTeacher)); school.AddClass(new Class("12a", secondTeacher)); }
static void Main() { List<Discipline> listOfDisciplines = new List<Discipline>(); listOfDisciplines.Add(new Discipline("Physics", 10, 5)); listOfDisciplines.Add(new Discipline("Football", 14, 53)); listOfDisciplines.Add(new Discipline("Chemistry", 11, 2)); listOfDisciplines.Add(new Discipline("Biology", 1, 20)); listOfDisciplines.Add(new Discipline("Geography", 1, 5)); List<Teacher> listOfTeachers = new List<Teacher>(); listOfTeachers.Add(new Teacher("Pirinka", "Koleva", listOfDisciplines[4])); listOfTeachers[0].AddDiscipline(listOfDisciplines[2]); listOfTeachers.Add(new Teacher("Asparuh", "Senkov", listOfDisciplines[1])); listOfTeachers[1].AddDiscipline(listOfDisciplines[4]); listOfTeachers.Add(new Teacher("Pavel", "Apostolov", listOfDisciplines[0])); listOfTeachers[2].AddDiscipline(listOfDisciplines[3]); List<Student> allStudents = new List<Student>(); allStudents.Add(new Student("ttt", "mmm", 1)); allStudents.Add(new Student("mmm", "KKK", 2)); allStudents.Add(new Student("ppp", "yyy", 3)); allStudents.Add(new Student("aaa", "bbb", 4)); allStudents.Add(new Student("www", "eee", 5)); allStudents.Add(new Student("rrr", "ccc", 6)); allStudents.Add(new Student("sss", "qqq", 7)); allStudents.Add(new Student("zzz", "xxx", 8)); List<SchoolClass> classes = new List<SchoolClass>(); classes.Add(new SchoolClass("12a", new Teacher[] { listOfTeachers[0], listOfTeachers[1] }, new Student[] { allStudents[0], allStudents[1], allStudents[2], allStudents[3] })); classes.Add(new SchoolClass("1a", new Teacher[] { listOfTeachers[2], listOfTeachers[0] }, new Student[] { allStudents[5], allStudents[6], allStudents[7] })); School school = new School(); school.AddClass(classes[0]); school.AddClass(classes[1]); SchoolClass getClass = school.GetClassByID("12a"); Console.WriteLine("Original class: {0} \nNumber of students: {1}", getClass.GetUnqID, getClass.GetNumberOfStudents); getClass.AddStudent(allStudents[6]); Console.WriteLine("\nAdded a student to a class -\nclass: {0} \nNumber of students: {1} \nNumber of Teachers: {2}", getClass.GetUnqID, getClass.GetNumberOfStudents, getClass.GetNumberOfTeachers); getClass.RemoveStudent(allStudents[0]); Console.WriteLine("\nRemoved a student -\nclass: {0} \nstudents: {1}", getClass.GetUnqID, getClass.GetNumberOfStudents); getClass.Comment = "avoid eye contact"; Console.WriteLine("\nClass: {0} \nNumber of students: {1}\nComment: {2}", getClass.GetUnqID, getClass.GetNumberOfStudents, getClass.Comment); }
//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); }
//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() { School TelerikSchool = new School("Telerik"); SchoolClass telerikClass = new SchoolClass(); SchoolClass writersClass = new SchoolClass(); SchoolClass dotaCharactersClass = new SchoolClass(); telerikClass.AddStudent(new Student("Svetlin", "Nakov", 30)); telerikClass.AddStudent(new Student("Doncho", "Minkov", 25)); telerikClass.AddStudent(new Student("Nikolay", "Kostov", 23)); telerikClass.AddStudent(new Student("George", "Georgiev", 22)); telerikClass.AddTeacher(new Teacher("Pavel", "Kolev", 24)); telerikClass.AddTeacher(new Teacher("Mihail", "Petrov", 23)); telerikClass.AddTeacher(new Teacher("Lyubomir", "Yanchev", 18)); writersClass.AddStudent(new Student("Ivan", "Vazov", 23)); writersClass.AddStudent(new Student("Lyuben", "Karavelov", 22)); writersClass.AddTeacher(new Teacher("Dimcho", "Debelqnov", 24)); writersClass.AddTeacher(new Teacher("Nikola", "Vapcarov", 23)); dotaCharactersClass.AddStudent(new Student("Tinker", "Bouch", 22)); dotaCharactersClass.AddStudent(new Student("Spectre", "Mercurial", 22)); dotaCharactersClass.AddStudent(new Student("Alleria", "Windrunner", 22)); dotaCharactersClass.AddStudent(new Student("Drow", "Ranger", 22)); dotaCharactersClass.AddTeacher(new Teacher("Zeus", "Lord of olympia", 24)); dotaCharactersClass.AddTeacher(new Teacher("Kunka", "Captain", 24)); dotaCharactersClass.AddTeacher(new Teacher("Mortred", "Phantom assassin", 24)); dotaCharactersClass.AddTeacher(new Teacher("Pudge", "Butcher", 24)); dotaCharactersClass.AddTeacher(new Teacher("Mirana", "Priestess of the moon", 23)); TelerikSchool.AddClass(new SchoolClass()); TelerikSchool.AddClass(telerikClass); TelerikSchool.AddClass(writersClass); TelerikSchool.AddClass(dotaCharactersClass); Console.WriteLine(TelerikSchool); }
static void Main() { School TelerikSchool = new School("Telerik"); SchoolClass telerikClass = new SchoolClass(); SchoolClass writersClass = new SchoolClass(); SchoolClass dotaCharactersClass = new SchoolClass(); telerikClass.AddStudent(new Student("Svetlin", "Nakov", 30)); telerikClass.AddStudent(new Student("Doncho", "Minkov", 25)); telerikClass.AddStudent(new Student("Nikolay", "Kostov", 23)); telerikClass.AddStudent(new Student("George", "Georgiev", 22)); telerikClass.AddTeacher(new Teacher("Pavel", "Kolev", 24)); telerikClass.AddTeacher(new Teacher("Mihail", "Petrov", 23)); telerikClass.AddTeacher(new Teacher("Lyubomir", "Yanchev", 18)); writersClass.AddStudent(new Student("Ivan", "Vazov", 23)); writersClass.AddStudent(new Student("Lyuben", "Karavelov", 22)); writersClass.AddTeacher(new Teacher("Dimcho", "Debelqnov", 24)); writersClass.AddTeacher(new Teacher("Nikola", "Vapcarov", 23)); dotaCharactersClass.AddStudent(new Student("Tinker", "Bouch", 22)); dotaCharactersClass.AddStudent(new Student("Spectre", "Mercurial", 22)); dotaCharactersClass.AddStudent(new Student("Alleria", "Windrunner", 22)); dotaCharactersClass.AddStudent(new Student("Drow", "Ranger", 22)); dotaCharactersClass.AddTeacher(new Teacher("Zeus", "Lord of olympia", 24)); dotaCharactersClass.AddTeacher(new Teacher("Kunka", "Captain", 24)); dotaCharactersClass.AddTeacher(new Teacher("Mortred", "Phantom assassin", 24)); dotaCharactersClass.AddTeacher(new Teacher("Pudge", "Butcher", 24)); dotaCharactersClass.AddTeacher(new Teacher("Mirana", "Priestess of the moon", 23)); TelerikSchool.AddClass(new SchoolClass()); TelerikSchool.AddClass(telerikClass); TelerikSchool.AddClass(writersClass); TelerikSchool.AddClass(dotaCharactersClass); Console.WriteLine(TelerikSchool); }
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); } }
//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; }
private static void Main(string[] args) { var students = new List<Student> { new Student("Gosho", 1), new Student("Mincho", 2) }; var teachers = new List<Teacher> { new Teacher("Tisho"), new Teacher("Misho") }; var classes = new List<Class> { new Class("math", students, teachers), }; var disciplines = new List<Discipline> { new Discipline("Discrete Structures", 1, 1) }; School sc = new School(classes); Console.WriteLine(string.Join(",", sc.GetClassNames())); sc.AddClass(new Class("pesho", new List<Student>(), new List<Teacher>())); Console.WriteLine(string.Join(",", sc.GetClassNames())); sc.GetClassById("pesho").AddComment("V tozi klas uchim visual Pesho++"); sc.GetClassById("pesho").PrintComments(); classes.ElementAt(0).GetStudentByID(1).ChangeId(5, classes.ElementAt(0)); sc.GetClassById("math").GetTeacherByName("Tisho").AddDiscipline(disciplines[0]); sc.GetClassById("math") .GetTeacherByName("Tisho") .GetDisciplineByName("Discrete Structures") .AddComment("Abandon hope all ye who enter here"); disciplines[0].PrintComments(); }
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 }
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 }