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

📄 testlogic.java

📁 简单的在线考试系统 提供添加修改 考试等操作
💻 JAVA
字号:
package olts;
import java.io.*;

public class TestLogic {	
	/*this class is the test logic class to combine the 
	 * database and the user interface and make some logic operation
	 */
	public static int scoreAll=0;
	private static int id=0;
	public StringBuffer buf=new StringBuffer();
	public String testInput(String readFile){
		try{
		String line;
		FileInputStream file=new FileInputStream(readFile);
		InputStreamReader in=new InputStreamReader(file);
		BufferedReader reader=new BufferedReader(in);
		while((line=reader.readLine())!=null){
			buf.append(line+"\n");
			}
		}catch(IOException e){
			System.out.println("error"+e.toString());
		}
		return buf.toString();
	}
	public void setID(int inputID){
		id=inputID;
	}
	public int getID(){
		return id;
	}
	public boolean questionMark(String answer,String input){
		
		if(answer.equals(input)){
			return true;
		}
		return false;
	}
	public int getMark() throws Exception{
		DatabaseSQLCommand database=new DatabaseSQLCommand();
		AnswerPane test=new AnswerPane();
		if(test.getType().equals("s")){
		if(questionMark(database.queryAnswer(id),test.singleChoice())){
			scoreAll+=Integer.parseInt(database.queryScore(id));
			}
		}else if(test.getType().equals("t")){
			if(questionMark(database.queryAnswer(id),test.tfChoice())){
				scoreAll+=Integer.parseInt(database.queryScore(id));
			}
		}else if(test.getType().equals("b")){
			if(questionMark(database.queryAnswer(id),test.blankChoice())){
				scoreAll+=Integer.parseInt(database.queryScore(id));
			}
		}
		return scoreAll;	
	}
	public int sentMark(){
		return scoreAll;
	}
}

⌨️ 快捷键说明

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