Пример #1
0
        public override float RatioOfBoysFromTotal(User i_LoggedInUser, LogicApp i_logicApp)
        {
            int counterBoys  = 0;
            int counterGirls = 0;

            String userGender = UsefulMethods.getGender(i_LoggedInUser);

            foreach (User friend in i_logicApp.getListOfFriends())
            {
                String friendGender = UsefulMethods.getGender(friend);

                if (friendGender == "female")
                {
                    counterGirls += 1;
                }
                else
                {
                    counterBoys += 1;
                }
            }

            float result = counterBoys / i_LoggedInUser.Friends.Count;

            return(result);
        }
Пример #2
0
        public override float RatioOfBoysFromTotal(User i_LoggedInUser, LogicApp i_logicApp)
        {
            int counterBoys  = 0;
            int counterGirls = 0;

            String userGender = UsefulMethods.getGender(i_LoggedInUser);

            foreach (User friend in i_logicApp.getListOfFriends())
            {
                String m_friendGender           = UsefulMethods.getGender(friend);
                String m_UserRelationshipStatus = UsefulMethods.getRelationshipStatus(friend);

                if (m_friendGender == "female" && !(m_UserRelationshipStatus.Equals("Married") || m_UserRelationshipStatus.Equals("In a relationship")))
                {
                    counterGirls += 1;
                }
                else
                {
                    counterBoys += 1;
                }
            }

            float result = counterBoys / i_LoggedInUser.Friends.Count;

            return(result);
        }
Пример #3
0
        private void checkRatio()
        {
            if (m_logicApp.getListOfFriends().Count == 0)
            {
                resultMessageTextBox.Text = "You are poor ,get a life!!";

                return;
            }

            string genderOfLoggedInUser = UsefulMethods.getGender(m_LoggedInUser);
            float  resultOfCalculation  = m_Strategy.RatioOfBoysFromTotal(m_LoggedInUser, m_logicApp);

            resultMessageTextBox.Text = Message.BuilderMessage(genderOfLoggedInUser, resultOfCalculation, ref picture_smallPictureBox);
        }