Exemplo n.º 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();
            }
        }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
        public void AddAnswer(Question q, ToasterAnswer answer)
        {
            int n = GetQuestionIndex(q);

            answers[n] = answer;
        }