You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PAIR/src/main/java/com/pair/model/QuizResult.java

58 lines
1.4 KiB

package com.pair.model;
//答题结果
public class QuizResult {
private int totalQuestions; // 总题数
private int correctCount; // 正确题数
private int wrongCount; // 错误题数
private int score; // 得分
public QuizResult(int totalQuestions, int correctCount, int wrongCount, int score) {
this.totalQuestions = totalQuestions;
this.correctCount = correctCount;
this.wrongCount = wrongCount;
this.score = score;
}
public int getTotalQuestions() {
return totalQuestions;
}
public void setTotalQuestions(int totalQuestions) {
this.totalQuestions = totalQuestions;
}
public int getCorrectCount() {
return correctCount;
}
public void setCorrectCount(int correctCount) {
this.correctCount = correctCount;
}
public int getWrongCount() {
return wrongCount;
}
public void setWrongCount(int wrongCount) {
this.wrongCount = wrongCount;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
@Override
public String toString() {
int correctPercent = (int) ((double) correctCount / totalQuestions * 100);
return "您答对了" + correctCount + "/" + totalQuestions + "题,得分:" + correctPercent;
}
}