static void Main(string[] args) { Console.OutputEncoding = Encoding.UTF8; try { try { Turner Turner1 = new Turner("", "Svirid", 23, "machine operator of wide profile", "AutoCardan", 24000); Student Student1 = new Student("Maxim", "Svirid", 29, "BSTU", "POIT", 2, "English"); Employee Employee1 = new Employee("Maxim", "Svirid", 36, "Hight", "AutoCardan", 700); Turner Turner2 = new Turner("Maxim", "Svirid", 25, "machine operator of wide profile", "AutoCardan", 34000); Programmer Programmer1 = new Programmer("Maxim", "Svirid", 44, "JS, AspectJ, PL/M, REXX", "EPAM", 44000); Programmer Programmer2 = new Programmer("Maxim", "Svirid", 54, "JS, AspectJ, PL/M, REXX", "EPAM", 44000); FocusGroup A = new FocusGroup(); A.SetPerson = Turner1; #region A.SetPerson = Employee1; A.SetPerson = Student1; A.SetPerson = Turner2; A.SetPerson = Programmer2; A.SetPerson = Programmer1; Console.WriteLine(); Controler CONT = new Controler(); CONT.Show(A); Console.WriteLine(); Console.WriteLine(); CONT.Sort(A); CONT.Show(A); FocusGroup B = new FocusGroup(); B.Persons = CONT.GetProgrammers(A); CONT.Show(B); #endregion } catch (PersonException e) { e.GetMassage(); throw; } catch (FocusGroupException e) { e.GetMassage(); } finally { Console.WriteLine("Finally"); } } catch (PersonException e) { Console.WriteLine("Ошибка 123цйвыфчя"); } Console.ReadKey(); }
public void Show(FocusGroup obj) { foreach (Person i in obj.focusGroups) { Console.WriteLine(i.ToString()); Console.WriteLine(); } }
public List <Person> GetProgrammers(FocusGroup obj) { List <Person> Programmers = new List <Person>(); foreach (Person i in obj.focusGroups) { if (i is Programmer) { Programmers.Add(i); } } return(Programmers); }
public void KolStudents(FocusGroup obj) { int kol = 0; foreach (Person i in obj.focusGroups) { if (i is Student) { kol++; } } Console.WriteLine("Количество студентов {0}", kol); Console.WriteLine(); }
public void Sort(FocusGroup obj) { Person buf; for (int i = 0; i < obj.focusGroups.Count; i++) { for (int j = i + 1; j < obj.focusGroups.Count; j++) { if (obj.focusGroups[i].Age < obj.focusGroups[j].Age) { buf = obj.focusGroups[i]; obj.focusGroups[i] = obj.focusGroups[j]; obj.focusGroups[j] = buf; } } } }