Пример #1
0
  public void answerQuestion(int userAnswer) {
    Result res = getPartialResult().clone();
    setResponded(false);
    Question q = questionGenerator.getQuestion();
    System.out.println(q);
    System.out.println(userAnswer);
    if (q.getAnswer() == userAnswer) {
      res.setScore(result.getScore() + 1);
      res.updateResultByCategory(q.getCategory(), true);
    } else {
      res.updateResultByCategory(q.getCategory(), false);
    }

    long acumulatedTimeBefore = getAcumulatedTime();
    setAcumulatedTime(acumulatedTimeBefore + (System.currentTimeMillis() - getInitialTime()));
    setInitialTime(System.currentTimeMillis());
    res.setTime(getAcumulatedTime());
    setPartialResult(res);

    setResponded(true);
    configure(numberOfQuestions - 1);
  }