?? paper.java
字號:
package com.tarena.exam.model;
import java.util.ArrayList;
import java.util.List;
/**
* Paper類的對象代表一套試卷,包含若干Question(試題)
* @author new
*
*/
public class Paper {
private String subject;//科目
private List<Question> allQuestions;//所有試題對象
private List<String> answers;//學生的選擇
public Paper(String subject,List<Question> allQuestions){
this.subject=subject;
this.allQuestions=allQuestions;
answers=new ArrayList<String>();
}
public Paper(String subject){
this.subject=subject;
allQuestions=new ArrayList<Question>();
answers=new ArrayList<String>();
}
public boolean addQuestion(Question q){
return allQuestions.add( q);
}
public String toString(){
StringBuffer sb=new StringBuffer(subject+"考試試題\n");
for(int i=0;i<allQuestions.size();i++){
sb.append((i+1)+","+allQuestions.get(i));
}
return sb.toString();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -