/** Method run in case of wrong answer. */ private void answeredWrongly() { student.increaseNumberOfWrongAnswers(); if (student.getNumberOfWrongAnswers() >= 9) { student.setNumberOfWrongAnswers(0); changeDifficulty(student.getDifficulty() - 1); } }
/** Method run in case of correct answer. */ private void answeredCorrectly() { increaseScore(); student.increaseNumberOfCorrectAnswers(); if (student.getNumberOfRightAnswers() >= 9) { changeDifficulty(student.getDifficulty() + 1); student.setNumberOfRightAnswers(0); } }
/** * Sets the desired difficulty. * * @param difficulty Integer; 1-10 */ public void changeDifficulty(int difficulty) { student.setDifficulty(difficulty); this.questionsController = new QuestionsController(10, student.getDifficulty(), student.getOperationType()); }
/** @param student An Object of the class Student. */ public GameController(Student student) { this.student = student; this.questionsController = new QuestionsController(10, student.getDifficulty(), student.getOperationType()); }