theme changed
This commit is contained in:
30
labs/lab9/LearningCenter/Program.cs
Normal file
30
labs/lab9/LearningCenter/Program.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var people = new List<Person>
|
||||
{
|
||||
new Administrator("Иванова", new DateTime(1985, 3, 12), "Лаборатория сетей", 8, 900m),
|
||||
new Student("Петров", new DateTime(2005, 11, 2), "ФКТИ", 2),
|
||||
new Teacher("Сидоров", new DateTime(1979, 6, 25), "ФКТИ", "Доцент", 12, 1400m),
|
||||
new Manager("Кузнецова", new DateTime(1990, 1, 5), "ФКТИ", "Менеджер проектов", 6, 1100m),
|
||||
new Student("Орлова", new DateTime(2003, 4, 17), "ФПМИ", 4)
|
||||
};
|
||||
|
||||
foreach (var p in people) p.Show();
|
||||
|
||||
Console.WriteLine();
|
||||
int from = 20, to = 40;
|
||||
var inRange = people.Where(p => p.Age() >= from && p.Age() <= to);
|
||||
foreach (var p in inRange) p.Show();
|
||||
|
||||
Console.WriteLine();
|
||||
foreach (var e in people.OfType<IEmployee>())
|
||||
Console.WriteLine("{0}: {1}, подразделение: {2}, оклад: {3:F2}", e.GetType().Name, e.Position, e.Department, e.GetMonthlyPay());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user