Beispiel #1
0
    private static void CreateAndPrintLeutenantGeneral(string[] tokens, List <Private> privates)
    {
        try
        {
            var general = new LeutenantGeneral(int.Parse(tokens[1]),
                                               tokens[2],
                                               tokens[3],
                                               decimal.Parse(tokens[4]));

            Console.Write(general);

            for (int i = 5; i < tokens.Length; i++)
            {
                var id = int.Parse(tokens[i]);

                if (privates.Count > 0)
                {
                    Console.WriteLine("Privates:");
                    privates
                    .Where(x => x.Id == id)
                    .ToList()
                    .ForEach(x => Console.WriteLine($"  Name: {x.FirstName} {x.LastName} Id: {x.Id} Salary: {x.Salary:f2}"));
                }
            }
        }
        catch (Exception)
        {
            //ignored
        }
    }
Beispiel #2
0
    public static void Main()
    {
        string          input;
        List <ISoldier> army = new List <ISoldier>();

        while ((input = Console.ReadLine()) != "End")
        {
            var    args    = input.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).ToList();
            string command = args[0];
            switch (command)
            {
            case "Private":
                ISoldier privPrivate = new Private(int.Parse(args[1]), args[2], args[3], double.Parse(args[4]));
                army.Add(privPrivate);
                break;

            case "LeutenantGeneral":
                List <string> inputPrivate = args.GetRange(5, args.Count - 5);
                ISoldier      general      = new LeutenantGeneral(int.Parse(args[1]), args[2], args[3], double.Parse(args[4]), GetSoldiers(inputPrivate, army));
                army.Add(general);
                break;

            case "Engineer":
                if (args[5] != "Airforces" && args[5] != "Marines")
                {
                    break;
                }
                string        corp       = args[5];
                List <string> pairsInput = args.GetRange(6, args.Count - 6);
                ISoldier      engineer   = new Engineer(int.Parse(args[1]), args[2], args[3], double.Parse(args[4]), corp, ExtractRepairsList(pairsInput));
                army.Add(engineer);
                break;

            case "Commando":
                if (args[5] != "Airforces" && args[5] != "Marines")
                {
                    break;
                }
                corp = args[5];
                List <string> inputMission = args.GetRange(6, args.Count - 6);
                ISoldier      comando      = new Commando(int.Parse(args[1]), args[2], args[3], double.Parse(args[4]), corp, ExtractMission(inputMission));
                army.Add(comando);
                break;

            case "Spy":
                ISoldier spy = new Spy(int.Parse(args[1]), args[2], args[3], int.Parse(args[4]));
                army.Add(spy);
                break;

            default:
                Console.WriteLine("Invalid command");
                break;
            }
        }

        foreach (var soldier in army)
        {
            Console.WriteLine(soldier);
        }
    }
Beispiel #3
0
    private static void WorkWithLeutenantGeneral(List <Private> privates, string[] inputSoldiers)
    {
        List <Private> privateByIds = AddPrivates(privates, inputSoldiers);

        LeutenantGeneral leutenantGeneral = new LeutenantGeneral(inputSoldiers[2], inputSoldiers[3], inputSoldiers[1], double.Parse(inputSoldiers[4]), privateByIds);

        Console.WriteLine(leutenantGeneral);
    }
Beispiel #4
0
    internal string RegisterLeutenantGeneral(string id, string firstName, string lastName, double salary, IEnumerable <string> privatesIds)
    {
        LeutenantGeneral leutenantGeneral = new LeutenantGeneral(firstName, lastName, id, salary);

        leutenantGeneral.Privates = privatesIds.Select(pId => this.privates.First(p => p.Id == pId)).ToList();
        this.soldiers.Add(leutenantGeneral);
        return(leutenantGeneral.ToString());
    }
    private static Soldier CreateLeutenantGeneral(string[] tokens, List <Soldier> soldiers,
                                                  int id, string firstName, string lastName)
    {
        var salary    = decimal.Parse(tokens[4]);
        var leutenant = new LeutenantGeneral(id, firstName, lastName, salary);

        AddPrivates(tokens, soldiers, leutenant);
        return(leutenant);
    }
 private static void AddPrivates(string[] tokens, List <Soldier> soldiers, LeutenantGeneral leutenant)
 {
     for (int i = 5; i < tokens.Length; i++)
     {
         var privateId      = int.Parse(tokens[i]);
         var currentPrivate = soldiers.FirstOrDefault(a => a.Id == privateId);
         leutenant.AddPrivate((Private)currentPrivate);
     }
 }
Beispiel #7
0
 private static void GetPrivates(List <ISoldier> soldiers, string[] tokens, LeutenantGeneral liutenant)
 {
     for (int i = 5; i < tokens.Length; i++)
     {
         var      privateId = int.Parse(tokens[i]);
         ISoldier @private  = soldiers.FirstOrDefault(p => p.Id == privateId);
         liutenant.AddPrivate(@private);
     }
 }
    public void StartUp()
    {
        army = new List <ISoldier>();

        string inputLine;

        while ((inputLine = Console.ReadLine()) != "End")
        {
            var soldierTokens = inputLine.Split();

            var id        = soldierTokens[1];
            var firstName = soldierTokens[2];
            var lastName  = soldierTokens[3];
            var salary    = double.Parse(soldierTokens[4]);

            switch (soldierTokens[0])
            {
            case "Private":
                var privat = new Private(id, firstName, lastName, salary);
                army.Add(privat);
                break;

            case "LeutenantGeneral":
                var soldiers  = GetPrivatesData(soldierTokens.Skip(5).ToList());
                var leutenant = new LeutenantGeneral(id, firstName, lastName, salary, soldiers);
                army.Add(leutenant);
                break;

            case "Engineer":
                if (soldierTokens[5] != "Airforces" && soldierTokens[5] != "Marines")
                {
                    break;
                }
                var repairs  = ExctractPartsList(soldierTokens.Skip(6).ToList());
                var engineer = new Engineer(id, firstName, lastName, salary, soldierTokens[5], repairs);
                army.Add(engineer);
                break;

            case "Commando":
                var corp = soldierTokens[5];
                if (corp != "Airforces" && corp != "Marines")
                {
                    break;
                }
                var missions = GetMissionsData(soldierTokens.Skip(6).ToList());
                var commando = new Commando(id, firstName, lastName, salary, corp, missions);
                army.Add(commando);
                break;
            }
        }

        foreach (var soldier in army)
        {
            Console.WriteLine(soldier);
        }
    }
    private static void ParseDate(string inputLine)
    {
        var tokens = inputLine.Split();

        if (tokens[0].Equals("Private"))
        {
            var @private = new Private(tokens[1], tokens[2], tokens[3], double.Parse(tokens[4]));
            soldiers.Add(@private);
            return;
        }

        if (tokens[0].Equals("LeutenantGeneral"))
        {
            var leutenantGeneral = new LeutenantGeneral(tokens[1], tokens[2], tokens[3], double.Parse(tokens[4]));
            var privateIds       = tokens.Skip(5);
            var privates         = GetPrivates(privateIds, soldiers);
            privates.ForEach(x => leutenantGeneral.Privates.Add(x));
            soldiers.Add(leutenantGeneral);
            return;
        }

        if (tokens[0].Equals("Engineer"))
        {
            var engineer     = new Engineer(tokens[1], tokens[2], tokens[3], double.Parse(tokens[4]), tokens[5]);
            var restOfTokens = tokens.Skip(6).ToList();
            var repairs      = TakeRepairs(restOfTokens);
            foreach (var repair in repairs)
            {
                engineer.Repairs.Add(repair);
            }

            soldiers.Add(engineer);
            return;
        }

        if (tokens[0].Equals("Commando"))
        {
            if (tokens[5] != "Airforces" && tokens[5] != "Marines")
            {
                return;
            }

            var comando      = new Commando(tokens[1], tokens[2], tokens[3], double.Parse(tokens[4]), tokens[5]);
            var restOfTokens = tokens.Skip(6).ToList();
            var missions     = TakeMission(restOfTokens);
            foreach (var mission in missions)
            {
                comando.Missions.Add(mission);
            }

            soldiers.Add(comando);
            return;
        }

        soldiers.Add(new Spy(tokens[1], tokens[2], tokens[3], int.Parse(tokens[4])));
    }
Beispiel #10
0
 private static void ParseLeutenantGeneral(List <Soldier> soldiers, string[] tokens)
 {
     soldiers.Add(new LeutenantGeneral(tokens[1], tokens[2], tokens[3], decimal.Parse(tokens[4])));
     tokens = tokens.Skip(5).ToArray();
     foreach (var privateStr in tokens)
     {
         Private          privateObj       = (Private)soldiers.Single(x => x.Id == privateStr);
         LeutenantGeneral leutenantGeneral = (LeutenantGeneral)soldiers.Last();
         leutenantGeneral.AddPrivate(privateObj);
     }
 }
Beispiel #11
0
 private static void GetLeutenantGeneral(string[] inputParts)
 {
     List<int> ids = inputParts.Skip(5).Select(int.Parse).ToList();
     List<ISoldier> privates = new List<ISoldier>();
     foreach (int id in ids)
     {
         privates.Add(soldiers.FirstOrDefault(s => s.Id == id));
     }
     ILeutenantGeneral leutenantGeneral = new LeutenantGeneral(int.Parse(inputParts[1]), inputParts[2], inputParts[3], double.Parse(inputParts[4]), privates);
     soldiers.Add(leutenantGeneral);
 }
Beispiel #12
0
    public LeutenantGeneral CreateGeneral(List <string> cmdArgs)
    {
        var id        = cmdArgs[0];
        var firstName = cmdArgs[1];
        var lastName  = cmdArgs[2];
        var salary    = double.Parse(cmdArgs[3]);
        var privates  = ExtractPrivates(cmdArgs.Skip(4).ToList());

        var soldier = new LeutenantGeneral(id, firstName, lastName, salary, privates);

        return(soldier);
    }
Beispiel #13
0
    private static void AddCurrentLeutenantGeneral(List <Soldier> dudes, string[] info)
    {
        LeutenantGeneral currentLeutenantGeneral = new LeutenantGeneral(info[1], info[2], info[3], double.Parse(info[4]));

        for (int i = 5; i < info.Length; i++)
        {
            string currentPrivateId = info[i];

            currentLeutenantGeneral.AddPrivates(dudes.Find(x => x.Id == currentPrivateId) as Private);
        }
        dudes.Add(currentLeutenantGeneral);
    }
Beispiel #14
0
    private static void AddLeutenantGeneral(string[] tokens)
    {
        LeutenantGeneral general = new LeutenantGeneral(tokens[1], tokens[2], tokens[3], double.Parse(tokens[4]));

        for (int i = 5; i < tokens.Length; i++)
        {
            Private privat = (Private)soldiers.Single(s => s.Id == tokens[i]);
            general.AddPrivate(privat);
        }

        soldiers.Add(general);
    }
Beispiel #15
0
        private ISoldier GetlieutenantGeneral(int id, string firstName, string lastName, decimal salary, string[] inputArgs)
        {
            ILieutenantGeneral lieutenant = new LeutenantGeneral(firstName, lastName, id, salary);

            for (int i = 5; i < inputArgs.Length; i++)
            {
                var      privateId      = int.Parse(inputArgs[i]);
                IPrivate privateSoldier = (IPrivate)this.soldiers.FirstOrDefault(x => x.Id == privateId);
                lieutenant.Privates.Add(privateSoldier);
            }
            return(lieutenant);
        }
Beispiel #16
0
    private static Soldier GetSoldier(IEnumerable <string> info, List <Soldier> allSoldiers)
    {
        Queue <string> infoAsQueue = new Queue <string>(info);
        Soldier        current     = null;

        switch (infoAsQueue.Dequeue())
        {
        case "Private":
            current = new Private(infoAsQueue.Dequeue(),
                                  infoAsQueue.Dequeue(),
                                  infoAsQueue.Dequeue(),
                                  double.Parse(infoAsQueue.Dequeue())); break;

        case "LeutenantGeneral":
            current = new LeutenantGeneral(infoAsQueue.Dequeue(),
                                           infoAsQueue.Dequeue(),
                                           infoAsQueue.Dequeue(),
                                           double.Parse(infoAsQueue.Dequeue()),
                                           GetPrivates(allSoldiers, infoAsQueue)); break;

        case "Engineer":
            if (!((infoAsQueue as IList <string>)[5] == "Airforces" || (infoAsQueue as IList <string>)[5] == "Marines"))
            {
                break;
            }
            current = new Engineer(infoAsQueue.Dequeue(),
                                   infoAsQueue.Dequeue(),
                                   infoAsQueue.Dequeue(),
                                   double.Parse(infoAsQueue.Dequeue()),
                                   infoAsQueue.Dequeue(),
                                   GetRepairs(infoAsQueue)); break;

        case "Commando":
            if (!(infoAsQueue.Last() == "AirForces" || infoAsQueue.Last() == "Marines"))
            {
                break;
            }
            current = new Commando(infoAsQueue.Dequeue(),
                                   infoAsQueue.Dequeue(),
                                   infoAsQueue.Dequeue(),
                                   double.Parse(infoAsQueue.Dequeue()),
                                   infoAsQueue.Dequeue(),
                                   GetMissions(infoAsQueue)); break;

        case "Spy":
            current = new Spy(infoAsQueue.Dequeue(),
                              infoAsQueue.Dequeue(),
                              infoAsQueue.Dequeue(),
                              int.Parse(infoAsQueue.Dequeue())); break;
        }
        return(current);
    }
Beispiel #17
0
    public static void Main()
    {
        var input    = string.Empty;
        var privates = new List <Private>();

        while ((input = Console.ReadLine()) != "End")
        {
            var tokens      = input.Split();
            var soldierType = tokens[0];

            switch (soldierType)
            {
            case "Private":
                var privateSoldier = new Private(tokens[1], tokens[2], tokens[3], double.Parse(tokens[4]));
                privates.Add(privateSoldier);
                Console.WriteLine(privateSoldier.ToString());
                break;

            case "LeutenantGeneral":
                var soldiers         = tokens.Skip(5).ToArray();
                var leutenantGeneral = new LeutenantGeneral(tokens[1], tokens[2], tokens[3], double.Parse(tokens[4]));
                leutenantGeneral.AddSoldiers(soldiers, privates);
                Console.WriteLine(leutenantGeneral.ToString());
                break;

            case "Engineer":
                if (tokens[5] == "Airforces" || tokens[5] == "Marines")
                {
                    var repairs  = tokens.Skip(6).ToArray();
                    var engineer = new Engineer(tokens[1], tokens[2], tokens[3], double.Parse(tokens[4]), tokens[5]);
                    engineer.AddRepairs(repairs);
                    Console.WriteLine(engineer.ToString());
                }
                break;

            case "Commando":
                if (tokens[5] == "Airforces" || tokens[5] == "Marines")
                {
                    var missions = tokens.Skip(6).ToArray();
                    var commando = new Commando(tokens[1], tokens[2], tokens[3], double.Parse(tokens[4]), tokens[5]);
                    commando.AddMissions(missions);
                    Console.WriteLine(commando.ToString());
                }
                break;

            case "Spy":
                var spy = new Spy(tokens[1], tokens[2], tokens[3], int.Parse(tokens[4]));
                Console.WriteLine(spy.ToString());
                break;
            }
        }
    }
        private ISoldier GetLeutenantGeneral(int id, string firstName, string lastName, decimal salary, string[] inputArgs)
        {
            ILeutenantGeneral leutenantGeneral = new LeutenantGeneral(id, firstName, lastName, salary);

            for (int counter = 5; counter < inputArgs.Length; counter++)
            {
                int      privateId      = int.Parse(inputArgs[counter]);
                IPrivate privateSoldier = (IPrivate)this.soldiers.FirstOrDefault(s => s.Id == privateId);
                leutenantGeneral.Privates.Add(privateSoldier);
            }

            return(leutenantGeneral);
        }
Beispiel #19
0
        private ISoldier GetLeutenantGeneral(int id, string firstName, string lastname, decimal salary, string[] args)
        {
            ILieutenantGeneral lieutenantGeneral = new LeutenantGeneral(id, firstName, lastname, salary);

            for (int i = 5; i < args.Length; i++)
            {
                int      privateId      = int.Parse(args[i]);
                IPrivate privateSoldier = (IPrivate)soldiers.FirstOrDefault(x => x.Id == privateId);

                lieutenantGeneral.Privates.Add(privateSoldier);
            }

            return(lieutenantGeneral);
        }
Beispiel #20
0
    private static void AddSoldiers(ICollection <ISoldier> allSoldiers, string[] tokens)
    {
        string type      = tokens[0];
        int    id        = int.Parse(tokens[1]);
        string firstName = tokens[2];
        string lastName  = tokens[3];
        double salary    = double.Parse(tokens[4]);

        switch (type)
        {
        case "Private":

            Private privateSoldier = new Private(id, firstName, lastName, salary);
            allSoldiers.Add(privateSoldier);
            break;

        case "LeutenantGeneral":
            List <Private>   privates  = GetPrivateSoldiers(allSoldiers, tokens);
            LeutenantGeneral leutenant = new LeutenantGeneral(id, firstName, lastName, salary, privates);
            if (leutenant != null)
            {
                allSoldiers.Add(leutenant);
            }
            break;

        case "Engineer":
            if (AreCorpsValid(tokens))
            {
                string   corps    = tokens[5];
                Engineer engineer = new Engineer(id, firstName, lastName, salary, corps, GetRepairs(tokens));
                allSoldiers.Add(engineer);
            }
            break;

        case "Commando":
            if (AreCorpsValid(tokens))
            {
                string   corps    = tokens[5];
                Commando commando = new Commando(id, firstName, lastName, salary, corps, GetMissions(tokens));
                allSoldiers.Add(commando);
            }
            break;

        case "Spy":
            int codeNumber = int.Parse(tokens[4]);
            Spy spy        = new Spy(id, firstName, lastName, codeNumber);
            allSoldiers.Add(spy);
            break;
        }
    }
Beispiel #21
0
    private static void AddLeutenantGeneral(List <ISoldier> soldiers, string[] inputParams)
    {
        LeutenantGeneral leutenantGeneral = new LeutenantGeneral(inputParams[1], inputParams[2], inputParams[3],
                                                                 double.Parse(inputParams[4]));

        int numberOfPrivates = inputParams.Length - 5;

        for (int i = 0; i < numberOfPrivates; i++)
        {
            Private _private = (Private)soldiers.FirstOrDefault(x => x.Id == inputParams[5 + i]);

            leutenantGeneral.AddPrivate(_private);
        }

        soldiers.Add(leutenantGeneral);
    }
Beispiel #22
0
    private static ISoldier CreateLeutenantGeneral(string[] soldierInfo, string id, string firstName, string lastName)
    {
        var salary = decimal.Parse(soldierInfo[4]);
        var currentLeutenantGeneral = new LeutenantGeneral(id, firstName, lastName, salary);

        foreach (var privateId in soldierInfo.Skip(5))
        {
            var soldier = Soldiers.FirstOrDefault(s => s.Id == privateId);

            if (soldier is IPrivate @private)
            {
                currentLeutenantGeneral.AddPrivate(@private);
            }
        }

        return(currentLeutenantGeneral);
    }
Beispiel #23
0
    public static void AddLeutenantGeneral(string[] info, List <ISoldier> soldiers)
    {
        var             id        = int.Parse(info[1]);
        var             firstName = info[2];
        var             lastName  = info[3];
        double          salary    = double.Parse(info[4]);
        List <ISoldier> privates  = new List <ISoldier>();

        for (int i = 5; i < info.Length; i++)
        {
            ISoldier newPrivate = (ISoldier)soldiers.Find(p => p.Id == int.Parse(info[i]));
            privates.Add(newPrivate);
        }

        LeutenantGeneral leutenantGeneral = new LeutenantGeneral(firstName, lastName, id, salary, privates);

        soldiers.Add(leutenantGeneral);
    }
Beispiel #24
0
    private static void AddLeutanant(List <Soldier> soldiers, string[] tokens)
    {
        var leutenantGeneral = new LeutenantGeneral(int.Parse(tokens[1]), tokens[2], tokens[3], decimal.Parse(tokens[4]));

        for (int i = 5; i < tokens.Length; i++)
        {
            foreach (var soldier in soldiers)
            {
                if (soldier.GetType().FullName == "Private" &&
                    !leutenantGeneral.Privates.Contains((Private)soldier) &&
                    int.Parse(tokens[i]) == soldier.Id)
                {
                    leutenantGeneral.Privates.Add((Private)soldier);
                }
            }
        }
        soldiers.Add(leutenantGeneral);
    }
Beispiel #25
0
        private static void CreateLeutenantGeneral(string[] soldierArgs)
        {
            var id           = int.Parse(soldierArgs[1]);
            var firstName    = soldierArgs[2];
            var lastName     = soldierArgs[3];
            var salary       = double.Parse(soldierArgs[4]);
            var privates     = new List <ISoldier>();
            var privatesArgs = soldierArgs.Skip(5).ToList();

            foreach (var privId in soldierArgs.Skip(5))
            {
                var soldier = army.First(s => s.Id == int.Parse(privId));
                privates.Add(soldier);
            }
            var leutenantGeneral = new LeutenantGeneral(id, firstName, lastName, salary, privates);

            army.Add(leutenantGeneral);
        }
Beispiel #26
0
    private static void AddLeutenantGeneral(string[] soldierArgs, Dictionary <int, Soldier> idSoldiers)
    {
        //  LeutenantGeneral<id> < firstName > < lastName > < salary > < private1Id > < private2Id > … < privateNId >    }
        var id        = int.Parse(soldierArgs[0]);
        var firstName = soldierArgs[1];
        var lastName  = soldierArgs[2];
        var salary    = double.Parse(soldierArgs[3]);

        var privateIds  = soldierArgs.Skip(4).Select(int.Parse).ToArray();
        var privateList = new List <IPrivate>();

        for (int i = 0; i < privateIds.Length; i++)
        {
            privateList.Add((IPrivate)idSoldiers[privateIds[i]]);
        }
        var leutenantGeneral = new LeutenantGeneral(id, firstName, lastName, salary, privateList);

        idSoldiers.Add(id, leutenantGeneral);
    }
Beispiel #27
0
    internal string RegisterLeutenantGeneral(string id, string firstName, string lastName, double salary,
                                             IEnumerable <string> privatesIds)
    {
        var leutenantGeneralPrivates = new List <IPrivate>();

        foreach (var privateId in privatesIds)
        {
            var currentPrivate = this.privates.FirstOrDefault(p => p.Id == privateId);
            if (currentPrivate != null)
            {
                leutenantGeneralPrivates.Add(currentPrivate);
            }
        }
        var currentSolider = new LeutenantGeneral(id, firstName, lastName, salary, leutenantGeneralPrivates);

        this.soliders.Add(currentSolider);

        return(currentSolider.ToString());
    }
    private static LeutenantGeneral GetGeneralData(string[] soldierInfo, List <ISoldier> soldiers)
    {
        var id     = soldierInfo[1];
        var first  = soldierInfo[2];
        var last   = soldierInfo[3];
        var salary = double.Parse(soldierInfo[4]);

        var general = new LeutenantGeneral(id, first, last, salary);

        var generalSubordinatesIds = soldierInfo.Skip(5).ToArray();

        if (soldiers.Count > 0)
        {
            soldiers
            .Where(p => generalSubordinatesIds.Contains(p.Id))
            .ToList()
            .ForEach(p => general.AddPrivate(p));
        }

        return(general);
    }
Beispiel #29
0
    public static ISoldier CreateSoldier(List <ISoldier> soldiers, string[] tokens, string soldierType, int id, string firstName, string lastName, decimal salary)
    {
        switch (soldierType)
        {
        case "Private":
            return(new Private(id, firstName, lastName, salary));

        case "LeutenantGeneral":
            var commandingSoldiers = tokens.Skip(5);
            var liutenant          = new LeutenantGeneral(id, firstName, lastName, salary);

            GetPrivates(soldiers, tokens, liutenant);

            return(liutenant);

        case "Commando":
            var commandoCorps = tokens[5];
            var commando      = new Commando(id, firstName, lastName, salary, commandoCorps);

            GetMissions(tokens, commando);

            return(commando);

        case "Engineer":
            var engineerCorps = tokens[5];
            var repairs       = tokens.Skip(5);
            var engineer      = new Engineer(id, firstName, lastName, salary, engineerCorps);
            GetRepairs(tokens, engineer);

            return(engineer);

        case "Spy":
            var codeNumber = (int)salary;

            return(new Spy(id, firstName, lastName, codeNumber));

        default:
            return(null);
        }
    }
    private static void ExecuteLeutenantGeneral(List <string> inputLineArgs)
    {
        int    id        = int.Parse(inputLineArgs[0]);
        string firstName = inputLineArgs[1];
        string lastName  = inputLineArgs[2];
        double salary    = double.Parse(inputLineArgs[3]);

        ILeutenantGeneral leutenantGeneral = new LeutenantGeneral(id, firstName, lastName, salary);

        var targetPrivateIds = inputLineArgs.Skip(4).Select(int.Parse).ToList();

        foreach (var privateId in targetPrivateIds)
        {
            if (privates.ContainsKey(privateId))
            {
                var targetPrivate = privates[privateId];
                leutenantGeneral.Privates.Add(targetPrivate);
            }
        }

        Console.WriteLine(leutenantGeneral.ToString().Trim());
    }