(11)点击成绩对话框,进入菜单界面,在菜单界面点击查询成绩,弹出考试成绩
25
4.3 程序编码 4.3.1 随机选题
系统根据用户设置的题型及课程自动为相应题型抽取相应数量的试题。
int i = 0;
Random random = new Random();
for(int level= Question.LEVEL1;level<=Question.LEVEL10;level++){
List
4.3.2 人工评卷
private void gameOver(JFrame source) {
}
int index = questionInfo.getQuestionIndex();
List
int score = service.commit();
JOptionPane.showConfirmDialog(source, \分数是:\examFrame.setVisible(false); menuFrame.setVisible(true); timer.cancel();
26
@13
4.3.3 考试计时 private void startTimer() {
}
int timeLimit = examInfo.getTimeLimit(); long startTime = System.currentTimeMillis(); final long endTime = startTime+timeLimit*60*1000; timer.schedule(new TimerTask(){ @9
public void run(){ }
long now = System.currentTimeMillis(); long limit = endTime - now;//剩余时间 showTime(limit);//显示剩余时间 if(limit<0){ }
timeout();
}, 0,1000);//从0秒开始,间隔我1妙
4.3.4 获取下一题信息
点击下一题按钮时,获取下一题信息
public void next(JFrame source) {
try{
int index = questionInfo.getQuestionIndex(); if(index+1==examInfo.getQuestionCount()){ }
List
27
return ;
questionInfo=service.getQuestion(index+1);
}catch(ExamOverException e){ }
e.printStackTrace();
JOptionPane.showConfirmDialog(source,e.getMessage());
4.3.5依据配置文件装载试题
private void addByLevel(Question q) { List
= levels.get(q.getLevel()); if (list == null){
list = new ArrayList
list.add(q); }
4.3.6 获取试题信息
对试题进行遍历,读取试题题干以及标题,通过读取试题标题获得试题分值,难易程度等信息
private void readOption
(Question q, BufferedReader in) throws IOException{
List
q.setOptions(options); }
private void readTitle
(Question q, BufferedReader in) throws IOException {
q.setTitle(in.readLine()); }
private Question parseField(String line) { String [] data = line.split(\ Question q = new Question();
28
q.setOptionNums(
Integer.parseInt(data[1].split(\ q.setAnswer(
parseAnswer(data[2].split(\ q.setScore(
Integer.parseInt(data[3].split(\ q.setLevel(
Integer.parseInt(data[4].split(\ return q; }
4.4 系统测试 4.4.1测试环境
Eclipse 4.4.2测试过程
(1)基本测试过程:使用考生帐号登录后进行在线考试,查询成绩,添加试题,添加试卷,查看考试规则等全部功能的测试。
并发行测试过程:同时使用多个用户登录,检测系统对并发性事件的处理能力。
(2)具体模块测试采用黑盒测试,在根据需求分析中的测试要求,在概要设计中为每个模块指定了详细的测试计划,根据此测试计划,进行测试,并对对照测试结果和预期结果是否一致,测试计划如下:
29