예제 #1
0
        void BranchAdded(BranchesContainer branches, PlayersContainer basketball, PlayersContainer football)
        {
            for (int i = 0; i < branches.Count; i++)
            {
                for (int g = 0; g < basketball.Count; g++)
                {
                    if (branches.GetBranch(i).Team == basketball.GetPlayer(g).Team)
                    {
                        branches.branches[i].Basketballists.AddPlayer(basketball.GetPlayer(g));
                    }
                }

                for (int g = 0; g < football.Count; g++)
                {
                    if (branches.GetBranch(i).Team == football.GetPlayer(g).Team)
                    {
                        branches.branches[i].Footballists.AddPlayer(football.GetPlayer(g));
                    }
                }
            }
        }
예제 #2
0
        PlayersContainer FilteredFootballists(BranchesContainer branches, string city)
        {
            PlayersContainer filteredFootbaliists = new PlayersContainer();

            for (int i = 0; i < branches.Count; i++)
            {
                if (branches.GetBranch(i).City == city && branches.GetBranch(i).Footballists.Count > 0)
                {
                    for (int g = 0; g < branches.GetBranch(i).Footballists.Count; g++)
                    {
                        if (branches.GetBranch(i).Footballists.GetPlayer(g).Score >= branches.GetBranch(i).Footballists.Average() &&
                            branches.GetBranch(i).Footballists.GetPlayer(g).AmountOfPlayedMatches == branches.GetBranch(i).AmountOfPlayedMatches)
                        {
                            filteredFootbaliists.AddPlayer(branches.GetBranch(i).Footballists.GetPlayer(g));
                        }
                    }
                    branches.GetBranch(i).City = "";
                    break;
                }
            }
            return(filteredFootbaliists);
        }