コード例 #1
0
        public string GetAward(MedusaKey key)
        {
            var correct = GetCorrectAnswers(key);

            int[] orderedLevels;

            switch (Grade)
            {
            case 6:
            case 7:
            case 8:
                orderedLevels = new int[] { 32, 29, 26, 22, 19 };
                return(GetAwardForGroup(orderedLevels, correct));

            case 9:
                orderedLevels = new int[] { 36, 31, 27, 23, 19 };
                return(GetAwardForGroup(orderedLevels, correct));

            case 10:
                orderedLevels = new int[] { 36, 33, 30, 24, 20 };
                return(GetAwardForGroup(orderedLevels, correct));

            case 11:
                orderedLevels = new int[] { 37, 34, 31, 25, 20 };
                return(GetAwardForGroup(orderedLevels, correct));

            case 12:
                orderedLevels = new int[] { 37, 35, 31, 26, 21 };
                return(GetAwardForGroup(orderedLevels, correct));

            default:
                return(None);
            }
        }
コード例 #2
0
 public bool IsAnswerCorrect(MedusaKey key, int questionIndex)
 {
     if (Answers.Count <= questionIndex || key.Answers.Count <= questionIndex)
     {
         return(false);
     }
     return(key.Answers[questionIndex] == "All" || key.Answers[questionIndex] == Answers[questionIndex]);
 }
コード例 #3
0
        public int GetCorrectAnswers(MedusaKey key)
        {
            int correct = 0;

            for (var i = 0; i < Answers.Count; i++)
            {
                if (IsAnswerCorrect(key, i))
                {
                    correct++;
                }
            }
            return(correct);
        }