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.
Math_Learning/src/Base/Exam_result.java

42 lines
1.4 KiB

package Base;
import java.util.Date;
import java.util.List;
public class Exam_result {
private String exam_type;
private int total_questions;
private int correct_answers;
private double score;
private long duration; // 考试时长(秒)
private List<Integer> wrong_questions; // 错题索引
public Exam_result( String examType, int total,
int correct, double score, long duration,
List<Integer> wrong) {
this.exam_type = examType;
this.total_questions = total;
this.correct_answers = correct;
this.score = Math.round(score * 100.0) / 100.0;
this.duration = duration;
this.wrong_questions = wrong;
}
public String getExamType() { return exam_type; }
public int getTotalQuestions() { return total_questions; }
public int getCorrectAnswers() { return correct_answers; }
public double getScore() { return score; }
public long getDuration() { return duration; }
public List<Integer> getWrongQuestions() { return wrong_questions; }
public String get_time() {
long minutes = duration / 60;
long seconds = duration % 60;
return String.format("%d分%d秒", minutes, seconds);
}
public String getCorrectRate() {
return String.format("%.1f%%", (double) correct_answers / total_questions * 100);
}
}