Пример #1
0
 public static void PrintAllWorkers(Worker[] workers)
 {
     for (int i = 0; i < workers.Length; i++)
     {
         workers[i].PrintInfo();
     }
 }
Пример #2
0
 public static void PrintWorkers(Worker[] workers)
 {
     for (int i = 0; i < workers.GetLength(0); i++)
     {
         workers[i].Print();
     }
 }
Пример #3
0
        static void Main(string[] args)
        {
            Worker[] workersArray = new Worker[4]
            {
                new Driver("Водитель1", 30, 12345678, "Мерседес", 400),
                new Driver("Водитель2", 46, 12312312, "Volvo", 256),
                new Manager("Менеджер1", 25, 4444444, 10),
                new Manager("Менеджер2", 31, 55555555, 8)
            };

            Worker.PrintAllWorkers(workersArray);
            Console.WriteLine();
            Console.WriteLine("Число работников: " + Worker.count);
            Console.WriteLine();

            int num = Int32.Parse(Console.ReadLine());
            Console.WriteLine(num);
            Console.ReadLine();
        }
Пример #4
0
        private static void ShowList()
        {
            Worker[] workers = new Worker[5];
            workers[0] = new Driver("John", 27, 6435, "BMW", 256);
            workers[1] = new Manager("Hulk", 25, 465138, 25);
            workers[2] = new Manager("Helena", 25, 478656, 12);
            workers[3] = new Driver("Jason", 45, 46513, "BMW", 256);
            workers[4] = new Manager("Mary", 27, 461577, 15);

            List<Worker> list = new List<Worker>();
            list.AddRange(workers);

            list.Insert(0, new Manager("Jenny", 25, 55431, 45));

            list.Reverse();
            foreach (Worker item in list)
            {
                item.Print();
            }

            List<int> list2 = new List<int>();
        }