예제 #1
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            ToasterAnswer answer = new ToasterAnswer();

            if (toaster.current_question.multiply)
            {
                for (int i = 0; i < cbs.Count; i++)
                {
                    answer.a[i] = cbs[i].Checked;
                }
            }
            else
            {
                for (int i = 0; i < rbs.Count; i++)
                {
                    answer.a[i] = rbs[i].Checked;
                }
            }

            toaster.AddAnswer(toaster.current_question, answer);

            // MessageBox.Show($"rating:{toaster.rating}");

            if (toaster.question < toaster.question_count - 1)
            {
                LoadQuestion(toaster.QuestionNext());
            }
            else
            {
                LoadResult();
            }
        }
예제 #2
0
 public void CalculateAnswers()
 {
     rating = 0;
     for (int i = 0; i < test.questions.Count; i++)
     {
         Question      q = test.questions[i];
         ToasterAnswer a = answers[i];
         rating += ReadAnswer(q, a);
     }
 }
예제 #3
0
        public double ReadAnswer(Question q, ToasterAnswer answer)
        {
            double rating_plus = 0;

            int c = q.variants.Count;

            for (int i = 0; i < c; i++)
            {
                if (answer.a[i])
                {
                    rating_plus += q.variants[i].rating;
                }
            }

            return(rating_plus);
        }
예제 #4
0
        public void AddAnswer(Question q, ToasterAnswer answer)
        {
            int n = GetQuestionIndex(q);

            answers[n] = answer;
        }