public SchoolClass(Student[] students, Teacher[] teachers, string id) { this.students = new List<Student>(students); this.teachers = new List<Teacher>(teachers); this.id = id; this.comments = new List<string>(); }
static void Main() { Student stud1 = new Student("Mario", 1); Student stud2 = new Student("Batman", 4); Student stud3 = new Student("Optimus Prime", 3); Student[] students = new Student[] { stud1, stud2, stud3 }; Disciplines disp1 = new Disciplines("OOP", 40, 40); Teacher teach1 = new Teacher("Morgan Freeman", new Disciplines[] { disp1 }); Teacher[] teachers = new Teacher[] { teach1 }; SchoolClass class1 = new SchoolClass(students, teachers, "12A"); Console.Write("The name of the first discipline of the first teacher of the first class: "); Console.WriteLine(class1.Teachers[0].Disciplines[0].Name); //tova gyrmi a ne vijdam pri4ina :( // stud1.AddComment("ninja"); // Console.Write("The first comment for the first studdent: "); // Console.WriteLine(stud1.Comments[0]); }
public void RemoveStudent(Student student) { this.students.Remove(student); }
public void AddStudent(Student student) { this.students.Add(student); }
static void Main(string[] args) { //Task 1 var teach = new Teacher("Kiro", new List<Discipline> { new Discipline("Math",20, 200)}); Console.WriteLine(teach.Name); var stud = new Student("Pesho", 1234); Console.WriteLine(stud.ClassNumber); Console.WriteLine(); //Task 2 var students = InitialiseStudents().OrderBy(x=>x.Grade).ToList(); foreach (var item in students) { Console.WriteLine(item); } Console.WriteLine(); var workers = InitialiseWorkers().OrderBy(x=>x.MoneyPerHour()).ToList(); foreach (var item in workers) { Console.WriteLine(item); } List<Problem2.Human> merged=new List<Problem2.Human>(); foreach (var item in students) { merged.Add(item); } foreach (var item in workers) { merged.Add(item); } merged = merged.OrderBy(x => x.FirstName).ThenBy(x=>x.LastName).ToList(); Console.WriteLine(); foreach (var item in merged) { Console.WriteLine(item); } Console.WriteLine(); //Task 3 var dogs = new List<Dog>(){ new Dog("Old Sharo","Male",12), new Dog("Sharo","Male",4), new Dog("Jony","Male",5), new Dog("Atilla","Female",2), new Dog("Rex","Male",6) }; Console.WriteLine("Dogs avg: {0}",dogs.Average(x=>x.Age)); var cats = new List<Cat>(){ new Tomcat("Persi",2), new Kitten("Leila",4), new Kitten("Baba mara",5), new Cat("Ginka","Female",2), new Tomcat("Anfibya",6) }; Console.WriteLine("Cats avg: {0}", cats.Average(x => x.Age)); var frogs = new List<Frog>(){ new Frog ("Car Jaba","Male" ,2), new Frog("Carica jaba","Female",4), new Frog("Grand mayster","Male",432), new Frog("Ginka","Female",2), new Frog("John Frog","Male",6) }; Console.WriteLine("Frogs avg: {0}", frogs.Average(x => x.Age)); }