⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 questionresult.java

📁 纯JAVA代码的考试系统
💻 JAVA
字号:
/**
 * TestResultItem.java
 * 本代码为教育目的而编写,但遵循产品代码规范。
 * 任何人任何时候都可以使用此代码,但需说明引用的代码来源于
 * www.fangsoft.org。
 * 欢迎任何建议。
 * 访问我们:
 * 		电子邮件:fangsoft.com@gmail.com
 * 		网站:   www.fangsoft.org
 * =====================================
 * This code is for software education,but it follows production code quality.
 * Anyone can use this code anywhere, but you should comment the code is from
 * www.fangsoft.org.
 * Any suggestion from you is appreciated. 
 * Visit us by
 *       email:    fangsoft.com@gmail.com
 *       websiste: www.fangsoft.org
 */
package org.fangsoft.testcenter.model;

/**
 * @author fangsoft 2007-2-10
 * 
 */
public class QuestionResult {
	private Question question;
	private int TR_ID;
	private int score = -1;
	private String answer;
	private boolean result;
	private int id;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int computeAnswer() {
		if (this.score >= 0)
			return this.score;
		if (this.answer == null || this.answer.length() == 0) {
			this.result = false;
			this.score = 0;
		} else if (this.question == null || this.question.getAnswer() == null) {
			this.result = false;
			this.score = 0;
		} else if (this.question.getAnswer().equals(this.answer)) {
			this.result = true;
			this.score = this.question.getScore();
			if (this.question.getScore() <= 0) {
				this.score = 1;
			}
		} else if (!this.question.getAnswer().equals(this.answer)) {
			this.result = false;
			this.score = 0;
		}
		return this.score;
	}

	public String getAnswer() {
		return answer;
	}

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

	public Question getQuestion() {
		return question;
	}

	public void setQuestion(Question question) {
		this.question = question;
	}

	public int getScore() {
		return score;
	}

	public void setScore(int score) {
		this.score = score;
	}

	public boolean getResult() {
		return result;
	}

	public void setResult(boolean result) {
		this.result = result;
	}

	public int getTR_ID() {
		return TR_ID;
	}

	public void setTR_ID(int tr_id) {
		TR_ID = tr_id;
	}
}

⌨️ 快捷键说明

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