// Function to evaluate quiz for the user input public void EvaluateQuiz() { bool isCorrectResponse = AdditionTutor.CheckAnswer(InputValue); // Write quiz result to file WriteQuizResultToFile(); // Display quiz result Output = isCorrectResponse ? CORRECT_ANSWER_RESPONSE : String.Format(INCORRECT_ANSWER_RESPONSE, InputValue); OutputExpression = AdditionTutor.Expression(); DisplayNewQuiz = VISIBILTIY_HIDDEN; DisplayQuizResult = VISIBILITY_VISIBLE; }
// Function to write quiz content to file public void WriteQuizResultToFile() { File.AppendAllText(FILE_NAME, String.Format(QUIZ_TEXT_FORMAT_FOR_FILE, AdditionTutor.Expression(), InputValue)); }