static void Main() { var disciplines = LoadDisciplines(); School newSchool = new School("OU \"Yane Sandanski\""); newSchool.AddClass(new Class("1A")); newSchool.Classes[0].AddTeacher(new Teacher("Dora", "Chekanova", disciplines)); newSchool.Classes[0].AddTeacher(new Teacher("Mita", "Georgieva", disciplines)); newSchool.Classes[0].AddTeacher(new Teacher("Ivan", "Uzunov", disciplines)); newSchool.AddClass(new Class("1B")); newSchool.Classes[1].AddTeacher(new Teacher("Desislava", "Botseva", disciplines)); newSchool.Classes[1].AddTeacher(new Teacher("Elena", "Madjarova", disciplines)); newSchool.Classes[1].AddTeacher(new Teacher("Mariyana", "Dimitrova", disciplines)); Console.WriteLine("TEST FOR SCHOOL: \n" + newSchool); Class someClass = newSchool.Classes[0]; Console.WriteLine("TEST FOR CLASS: \n" + someClass); Teacher someTeacher = newSchool.Classes[1].Teachers[1]; Console.WriteLine("TEST FOR TEACHER: \n" + someTeacher); Console.WriteLine(); Discipline someDiscipline = newSchool.Classes[0].Teachers[0].Disciplines[2]; Console.WriteLine("TEST FOR DISCIPLINE: \n" + someDiscipline); Console.WriteLine(); Student someStudent = new Student("Ivan", "Vasilev", 13); Console.WriteLine("TEST FOR STUDENT: \n" + someStudent); Console.WriteLine(); Console.WriteLine("TEST FOR COMMENT FIELD: " + someStudent.Comment); someStudent.Comment = "{0} is the laziest student in the entire school!"; Console.WriteLine(); Console.WriteLine("TEST FOR COMMENT FIELD AFTER CHANGING THE TEXT: " + someStudent.Comment, someStudent.FirstName); }
static void Main() { Console.WriteLine("Small Test:"); Student mara = new Student("Mara", 55); Student pesho = new Student("Pesho", 44); Teacher joro = new Teacher("Joro"); Discipline math = new Discipline("Mathematics", 15, 4); joro.AddDiscipline(math); SchoolClass myClass = new SchoolClass("1a"); myClass.AddStudent(mara); myClass.AddStudent(pesho); myClass.AddTeacher(joro); Console.WriteLine(myClass); try { SchoolClass myClass2 = new SchoolClass("1a"); } catch (ArgumentException e) { Console.WriteLine(e.Message); } try { Student gosho = new Student("Gosho", 44); } catch (ArgumentException e) { Console.WriteLine(e.Message); } }
static void Main() { School mySchool = new School("Telerik Academy"); // Creating students Student[] studentsFirstGroup = new Student[] { new Student("Georgi Yonchev", 2342032), new Student("Stamat Stamatov", 3023224), new Student("Pesho Ivanov", 3023434), new Student("Georgi Ivanov", 2223434), new Student("Mariya Ivanova", 4566434), new Student("Pesho Todorov", 2000032) }; Student[] studentsSecondGroup = new Student[] { new Student("Georgi Petrov", 1342032), new Student("Albenoa Kalinova", 2333224), new Student("Zahari Zahariev", 3023555), new Student("Hristo Georgiev", 2234554), new Student("Nikoleta Zlatkova", 7765004), new Student("Nikoleta Chaneva", 3023100) }; // Creating disciplines Discipline cSharp = new Discipline("C Sharp Fundamentals", 30, 30); Discipline javaScript = new Discipline("JavaScript Fundamentals", 40, 50); Discipline html = new Discipline("HTML5", 12, 13); Discipline css = new Discipline("CSS3"); // Creating teachers Teacher teacher1 = new Teacher("Nikolay Kostov"); Teacher teacher2 = new Teacher("Ivaylo Kenov"); Teacher teacher3 = new Teacher("Doncho Minkov"); Teacher teacher4 = new Teacher("Evlogi Hristov"); teacher1.AddDiscipline(javaScript, html, css); teacher2.AddDiscipline(cSharp); teacher3.AddDiscipline(html); teacher4.AddDiscipline(css); // Creating Group classes SchoolClass firstGroupClass = new SchoolClass("First Group-morning"); SchoolClass secondGroupClass = new SchoolClass("Second Group-evening"); firstGroupClass.AddTeacher(teacher1, teacher2); secondGroupClass.AddTeacher(teacher1, teacher3, teacher4); firstGroupClass.AddStudent(studentsFirstGroup); secondGroupClass.AddStudent(studentsSecondGroup); mySchool.AddClass(firstGroupClass); mySchool.AddClass(secondGroupClass); Console.WriteLine(mySchool); }
static void Main() { Student pesho = new Student("Pesho", 8); Student gosho = new Student("Gosho", 8, "kaval"); Teacher stamatov = new Teacher("Stamatov", "bastun"); Teacher petrova = new Teacher("Petrova"); Class myClass = new Class("A"); myClass.AddStudent(pesho); myClass.AddStudent(gosho); myClass.AddTeacher(stamatov); myClass.AddTeacher(petrova); Discipline biologia = new Discipline("biologia", 30, 30); Discipline matematika = new Discipline("matematika", 40, 40, "cool"); stamatov.AddDiscipline(biologia); petrova.AddDiscipline(matematika); for (int i = 0; i < myClass.Students.Count; i++) { Console.WriteLine(myClass.Students[i].Name); } Console.WriteLine(); myClass.RemoveStudent(pesho); for (int i = 0; i < myClass.Students.Count; i++) { Console.WriteLine(myClass.Students[i].Name); } Console.WriteLine(); for (int i = 0; i < myClass.Teachers.Count; i++) { Console.WriteLine(myClass.Teachers[i].Name); } myClass.RemoveTeacher(petrova); Console.WriteLine(); for (int i = 0; i < myClass.Teachers.Count; i++) { Console.WriteLine(myClass.Teachers[i].Name); } stamatov.AddDiscipline(matematika); Console.WriteLine(); for (int i = 0; i < stamatov.Disciplines.Count; i++) { Console.WriteLine(stamatov.Disciplines[i].NameOfDiscipline); } }
/* 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 a name and unique class number. Classes have unique text identifier. Teachers have a name. Disciplines have a 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. */ public static void Main() { Student dwayne = new Student("Pesho", "Peshov", 6); Console.WriteLine("Student name: {0}, Class number: {1}", dwayne.ToString(), dwayne.ClassNumber); Teacher firstTeacher = new Teacher( "Ivan", "Petkov", new Discipline("Math", 15, 20), new Discipline("Art", 10, 12)); Console.WriteLine(firstTeacher.ToString()); Teacher secondTeacher = new Teacher( "The", "Rock", new Discipline("Sports", 30, 40)); School newSchool = new School( new Class("12a", firstTeacher), new Class("12b", secondTeacher)); }
static void Main() { School school = new School("PMG"); Class firstClass = new Class('A'); Class secondClass = new Class('B'); Class thirdClass = new Class('V'); Teacher firstTeacher = new Teacher("Janeta", "super!"); Teacher secondTeacher = new Teacher("Gonzo", "stranen"); Student firstStudent = new Student("Ivan", "111213", "razdraznitelen"); Student secondStudent = new Student("Dragan", "111214", "otkachen"); Student thirdStudent = new Student("Petkan", "111215"); Student forthStudent = new Student("Stamat", "111216", "uchenolubiv"); Discipline math = new Discipline("Math", 5, 10); Discipline history = new Discipline("History", 2, 4); Discipline physics = new Discipline("Physics", 4, 8); Discipline english = new Discipline("English", 2, 4); school.AddClass(firstClass); school.AddClass(secondClass); school.AddClass(thirdClass); firstTeacher.AddDiscipline(math); firstTeacher.AddDiscipline(english); secondTeacher.AddDiscipline(history); secondTeacher.AddDiscipline(physics); firstClass.AddStudentToAClass(firstStudent); firstClass.AddStudentToAClass(secondStudent); secondClass.AddStudentToAClass(thirdStudent); thirdClass.AddStudentToAClass(forthStudent); firstClass.AddTeacherToAClass(firstTeacher); firstClass.AddTeacherToAClass(secondTeacher); secondClass.AddTeacherToAClass(firstTeacher); thirdClass.AddTeacherToAClass(secondTeacher); Console.WriteLine("School named {0} has {1} classes: \n\n {2} {3} {4}", school.Name, school.Classes.Count, firstClass, secondClass, thirdClass); }
static void Main(string[] args) { Student Pesho = new Student("Pesho Konstancaliev", 24, "stupid!"); Student Lacho = new Student("Lachezar Petrov", 2, "verry stupid!"); Student Penka = new Student("Penka Grozdanova", 4, "not so stupid!"); Student Evelina = new Student("Evelina Makedonska", 14, "stupid!"); Student Evstati = new Student("Evstati Penev", 1, "verry stupid!"); Student Drago = new Student("Drago Petrov", 11, "stupid!"); Student Muncho = new Student("Muncho Gunchev", 13, "stupid!"); Discipline Math = new Discipline("Math", 50, 50, "cool"); Discipline Geography = new Discipline("Geography", 2, 4, "verry cool"); Discipline Astronomy = new Discipline("Astronomy", 4, 10, "so-so"); Teacher Tomov = new Teacher(new Discipline[] {Math, Geography}, "Pesho Tomov", "stupid!"); Teacher Petrov = new Teacher(new Discipline[] { Astronomy, Geography }, "Harampi Petrov", "verry stupid!"); Teacher Dragov = new Teacher(new Discipline[] { Math, Astronomy }, "Drago Dragov", "stupid!"); Teacher Haralambev = new Teacher(new Discipline[] { Math, Geography }, "Mryshtio Haralambev", "stupid!"); ClassOfStudents theCoolestClass = new ClassOfStudents(new Student[] { Pesho, Evelina, Evstati, Drago }, new Teacher[] { Dragov, Haralambev, Tomov }, "5b"); }
static void Main() { Student aniPetrova = new Student("Ani"," Petrova", 1); Student gerogiMalinov = new Student("Gerogi"," Malinov",2); Student hristoVasilev = new Student("Hristo ","Vasilev",3); List<Student> studentsInClassA = new List<Student>(); studentsInClassA.Add(aniPetrova); studentsInClassA.Add(gerogiMalinov); studentsInClassA.Add(hristoVasilev); foreach (var student in studentsInClassA) { Console.WriteLine(student.ToString()); } Console.WriteLine(); Discipline math = new Discipline("Math", 10, 10); Discipline language = new Discipline("Language", 20, 10); Discipline art = new Discipline("Art", 5, 10); Teacher petarPetrov = new Teacher("Petar"," Petrov"); petarPetrov.AddDiscipline (math); petarPetrov.AddDiscipline(language); Teacher peshoPeshov = new Teacher("Pesho" ,"Peshov"); peshoPeshov.AddDiscipline(art); List<Teacher> teachersForAClass = new List<Teacher>() { petarPetrov, peshoPeshov }; Class classA = new Class("5A"); classA.AddTeacher(petarPetrov); classA.AddTeacher(peshoPeshov); Console.WriteLine(classA.ToString() + "\n" + string.Join("", classA.TeachersSet)); classA.AddComment("Hello"); classA.AddComment("This is our first class."); classA.AddComment("This is our last class!"); }
public static void Main() { Student a = new Student(); }
public void RemoveStudent(Student student) { students.Remove(student); }
public void AddStudents(Student student) { this.studentsSet.Add(student); }
public ClassOfStudents(Student[] students, Teacher[] teachers, string identifier, string comment) : this(students, teachers, identifier) { this.Comment = comment; }
public void AddStudent(Student newStudent) { this.students.Add(newStudent); }
public void RemoveStudent(Student student) { this.Students.Remove(student); }
public ClassOfStudents(Student[] students, Teacher[] teachers, string identifier) { this.ClassStudents = students; this.ClassTeachers = teachers; this.ClassIdentifier = identifier; }
public void AddStudent(Student student) { this.Students.Add(student); }
public void RemoveStudents(Student student) { this.studentsSet.Remove(student); }
public static void Main() { var school = new School("PG Gen. Vl. Zaimov"); //students var ivan = new Student("Ivan Ivanov", 100011); var stoyan = new Student("Stoyan Stoyanov", 100012); var dragan = new Student("Dragan Draganov", 200011); var pesho = new Student("Pesho Peshov", 200012); //teachers var ivo = new Teacher("Ivaylo Kenov"); var niki = new Teacher("Nikolay Kostov"); var doncho = new Teacher("Doncho Minkov"); var evlogi = new Teacher("Evlogi Hristov"); //classes var firstClass = new SchoolClass("100"); var secondClass = new SchoolClass("200"); //disciplines var geography = new Discipline("Geography", 2, 2); var history = new Discipline("History", 1, 2); var biology = new Discipline("Biology", 3, 1); var math = new Discipline("Math", 3, 2); var mpt = new Discipline("MPT", 1, 3); //adding classes to school school.AddClass(firstClass); school.AddClass(secondClass); //adding teachers and students to classes firstClass.AddStudents(ivan); firstClass.AddStudents(stoyan); firstClass.AddTeachers(ivo); firstClass.AddTeachers(evlogi); secondClass.AddStudents(dragan); secondClass.AddStudents(pesho); secondClass.AddTeachers(doncho); secondClass.AddTeachers(niki); //adding disciplines to teachers ivo.AddDisciplines(geography); niki.AddDisciplines(biology); doncho.AddDisciplines(mpt); doncho.AddDisciplines(geography); ivo.AddDisciplines(history); evlogi.AddDisciplines(biology); ivan.Comment = "I like geography!"; doncho.Comment = "Something."; geography.Comment = "Surface of Earth......"; firstClass.Comment = "Advanced."; Console.WriteLine("{0, 28}", school); Console.WriteLine(new string('*', 40)); Console.WriteLine("Class identifier: {0}", firstClass); Console.WriteLine("\nStudents: \n{0}", firstClass.GetStudents()); Console.WriteLine("Teachers: \n{0}", firstClass.GetTeachers()); Console.WriteLine("Teacher's disciplines: "); Console.WriteLine("{0}\n{1}",ivo, ivo.GetDisciplines()); Console.WriteLine("{0}\n{1}", evlogi, evlogi.GetDisciplines()); Console.WriteLine("Comments:"); Console.WriteLine("{0}: {1}", ivan.Name, ivan.Comment); Console.WriteLine("{0}: {1}", geography.Name, geography.Comment); }
//Methods public void AddStudentToAClass(Student student) { this.students.Add(student); }
public void AddStudent(Student student) { this.listOfStudents.Add(student); }