showquestionview.java

来自「纯JAVA代码的考试系统」· Java 代码 · 共 64 行

JAVA
64
字号
package org.fangsoft.testcenter.view.console;

import static org.fangsoft.util.Console.output;
import static org.fangsoft.util.Console.prompt;

import java.util.ArrayList;
import java.util.List;

import org.fangsoft.testcenter.model.ChoiceItem;
import org.fangsoft.testcenter.model.Question;
import org.fangsoft.testcenter.model.Test;
import org.fangsoft.testcenter.view.View;


public class ShowQuestionView extends ConsoleView implements View {
 //  private Test test=null;
	private Test test=null;
    private String answer=null;
    private int index=0;

	@Override
	public void displayView() {
		// TODO Auto-generated method stub
		//System.out.println(this.index);
		Question q=test.getQuestion(this.index);
		q.assignLabel(ChoiceItem.LABEL);
		this.answer=prompt(this.index + 1, q);
		/*int count=0;
		for (Question q : test.getQuestion()) {			
			q.assignLabel(ChoiceItem.LABEL);
			answer.add(prompt(count + 1, q));
			count++;
		}
		long end = System.currentTimeMillis();
		output("考试结束,现在时间是:%1$tT%n",end);*/
	}

	public String getAnswer() {
		return answer;
	}

	public void setAnswer(String answer) {
		this.answer = answer;
	}

	public Test getTest() {
		return test;
	}

	public void setTest(Test test) {
		// TODO Auto-generated method stub
		this.test = test;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?