private void AddRoyalGuards(King king, string[] royalGuardNames)
 {
     foreach (var name in royalGuardNames)
     {
         king.AddSubordinate(new RoyalGuard(name, this.writer));
     }
 }
 private void AddFootmans(King king, string[] footmanNames)
 {
     foreach (var name in footmanNames)
     {
         king.AddSubordinate(new Footman(name, this.writer));
     }
 }
Exemple #3
0
    private static IKing SetupKing()
    {
        string kingName = Console.ReadLine();
        IKing  king     = new King(kingName, new List <ISubordinate>());

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

        foreach (var name in royalGourdNames)
        {
            king.AddSubordinate(new RoyalGaurd(name));
        }

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

        foreach (var name in footmanNames)
        {
            king.AddSubordinate(new Footman(name));
        }

        return(king);
    }
    private static IKing SetupKing()
    {
        string kingsName = Console.ReadLine();

        IKing king = new King(kingsName, new List <ISubordinate>());

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

        foreach (string royalGuard in royalGuards)
        {
            king.AddSubordinate(new RoyalGuard(royalGuard));
        }

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

        foreach (string footman in footmen)
        {
            king.AddSubordinate(new Footman(footman));
        }

        return(king);
    }