Esempio n. 1
0
        private float GetAverageScore()
        {
            float holes = 0;
            float score = 0;
            float avg   = 0;

            foreach (ScoredMatch sm in _profile.Scores)
            {
                if (sm.Holes == 9)
                {
                    ScoredMatch csm = ConvertTo18Holes(sm);
                    holes += csm.Holes;
                    score += csm.Score;
                }
                else
                {
                    holes += sm.Holes;
                    score += sm.Score;
                }
            }

            if (holes > 0)
            {
                avg = (score / holes) * 18;
            }

            return(avg);
        }
Esempio n. 2
0
 private ScoredMatch ConvertTo18Holes(ScoredMatch score)
 {
     return(new ScoredMatch()
     {
         Score = score.Score * 2,
         Holes = score.Holes * 2
     });
 }
Esempio n. 3
0
 public string MessageMatchScore(ScoredMatch sm)
 {
     return($"Score: {sm.Score}\tHoles: {sm.Holes}\tPar: {sm.Par}");
 }