Exemplo n.º 1
0
        private static IKing SetUpKing()
        {
            string kingName = Console.ReadLine();

            IKing king = new King(kingName);

            string[] royalGuardsNames = Console.ReadLine().Split();

            foreach (string name in royalGuardsNames)
            {
                var royalGuard = new RoyalGuard(name);

                king.AddSubordinate(royalGuard);
            }

            string[] footmenNames = Console.ReadLine().Split();

            foreach (string name in footmenNames)
            {
                var footman = new Footman(name);

                king.AddSubordinate(footman);
            }

            return(king);
        }
Exemplo n.º 2
0
        private static IKing SetUpKing()
        {
            string kingName = Console.ReadLine();
            IKing  king     = new King(kingName, new List <ISubordinate>());

            string[] royalGuardNames = Console.ReadLine().Split();
            foreach (var name in royalGuardNames)
            {
                king.AddSubordinate(new RoyalGuard(name));
            }

            string[] footmanNames = Console.ReadLine().Split();
            foreach (var name in footmanNames)
            {
                king.AddSubordinate(new Footman(name));
            }

            return(king);
        }