Пример #1
0
        static void Main(string[] args)
        {
            EmployeeComposite mark      = new EmployeeComposite("Mark");
            Employee          catherine = new Employee("Catherine");
            Employee          david     = new Employee("David");

            EmployeeComposite kathy = new EmployeeComposite("Kathy");
            EmployeeComposite mike  = new EmployeeComposite("Mike");
            Employee          gage  = new Employee("Gage");
            Employee          reg   = new Employee("Reggie");

            //Lori is the boss of Mark and Kathy
            EmployeeComposite lori = new EmployeeComposite("Lori");

            lori.AddEmployee(mark);
            lori.AddEmployee(kathy);

            //Mark is the boss of Catherine, David
            mark.AddEmployee(catherine);
            mark.AddEmployee(david);

            //Kathy is the boss of Mike
            kathy.AddEmployee(mike);

            //Mike is the boss of Gage and Reg
            mike.AddEmployee(gage);
            mike.AddEmployee(reg);

            //Print, by calling the very top
            lori.PrintSupervisorOf(0);
            kathy.PrintSupervisorOf(0);
            mark.PrintSupervisorOf(0);
            Console.Read();
        }
Пример #2
0
        static void Main(string[] args)
        {
            EmployeeComposite mark      = new EmployeeComposite("Mark");
            Employee          catherine = new Employee("catherine");
            Employee          david     = new Employee("david");


            EmployeeComposite kathy = new EmployeeComposite("Kathy");
            EmployeeComposite mike  = new EmployeeComposite("Mike");
            Employee          gage  = new Employee("Gage");
            Employee          reg   = new Employee("Reggie ");



            // lori is the boss of Mark and Kathy

            EmployeeComposite lori = new EmployeeComposite("Lori");

            lori.AddEmployee(mark);

            lori.AddEmployee(kathy);



            // mark is the boss of catherine and david

            mark.AddEmployee(catherine);
            mark.AddEmployee(david);


            // kathy is the boss of mike

            kathy.AddEmployee(mike);


            // mike is the boss of gage and reg


            mike.AddEmployee(gage);
            mike.AddEmployee(reg);


            // print , bny calling the top

            lori.PrintSupervisorOf(0);

            Console.ReadKey();
        }
Пример #3
0
        static void Main(string[] args)
        {
            EmployeeComposite mark = new EmployeeComposite("Mark");
                    Employee catherine = new Employee("catherine");
                    Employee david = new Employee("david");

            EmployeeComposite kathy = new EmployeeComposite("Kathy");
               EmployeeComposite mike = new EmployeeComposite("Mike");
                   Employee gage = new Employee("Gage");
                   Employee reg = new Employee("Reggie ");

            // lori is the boss of Mark and Kathy

               EmployeeComposite lori = new EmployeeComposite("Lori");

               lori.AddEmployee(mark);

               lori.AddEmployee(kathy);

            // mark is the boss of catherine and david

               mark.AddEmployee(catherine);
               mark.AddEmployee(david);

            // kathy is the boss of mike

               kathy.AddEmployee(mike);

            // mike is the boss of gage and reg

               mike.AddEmployee(gage);
              mike.AddEmployee(reg);

            // print , bny calling the top

              lori.PrintSupervisorOf(0);

              Console.ReadKey();
        }