📄 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 + -