|
|
|
@ -147,7 +147,7 @@ public class ExamTakingController {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String answer = selectedOption.getText().substring(0, 1); // 获取A、B、C、D
|
|
|
|
String answer = getAnswerValue(selectedOption.getText().substring(0, 1)); // 获取答案
|
|
|
|
userAnswers.put(currentQuestionIndex, answer);
|
|
|
|
userAnswers.put(currentQuestionIndex, answer);
|
|
|
|
|
|
|
|
|
|
|
|
if (currentQuestionIndex == examQuestions.size() - 1) {
|
|
|
|
if (currentQuestionIndex == examQuestions.size() - 1) {
|
|
|
|
@ -160,7 +160,17 @@ public class ExamTakingController {
|
|
|
|
displayCurrentQuestion();
|
|
|
|
displayCurrentQuestion();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 添加辅助方法获取选项对应的实际值
|
|
|
|
|
|
|
|
private String getAnswerValue(String optionLetter) {
|
|
|
|
|
|
|
|
Question currentQuestion = examQuestions.get(currentQuestionIndex);
|
|
|
|
|
|
|
|
switch (optionLetter) {
|
|
|
|
|
|
|
|
case "A": return currentQuestion.getOptionA();
|
|
|
|
|
|
|
|
case "B": return currentQuestion.getOptionB();
|
|
|
|
|
|
|
|
case "C": return currentQuestion.getOptionC();
|
|
|
|
|
|
|
|
case "D": return currentQuestion.getOptionD();
|
|
|
|
|
|
|
|
default: return "";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
@FXML
|
|
|
|
@FXML
|
|
|
|
private void handleNextQuestion() {
|
|
|
|
private void handleNextQuestion() {
|
|
|
|
currentQuestionIndex++;
|
|
|
|
currentQuestionIndex++;
|
|
|
|
|