-
Notifications
You must be signed in to change notification settings - Fork 0
/
Exam.java
74 lines (55 loc) · 1.85 KB
/
Exam.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import java.io.Serializable;
import java.util.ArrayList;
public class Exam implements Serializable {
ArrayList<Question> questionLists = new ArrayList<Question>();
String title = "Title";
String description = "Description";
String subjectname;
public Exam() {
}
public Exam(String subjectname) {
this.subjectname = subjectname;
}
public String getSubjectname(){
return this.subjectname;
}
public void loadFromFile(String location) {
}
public void setTitle(String text) {
this.title = text;
}
public String getTitle() {
return title;
}
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
public void setQuestion(int index, Question element) {
questionLists.set(index, element);
}
public Question getQuestion(int index) {
return questionLists.get(index);
}
public void addQuestion(Question question) {
questionLists.add(question);
}
public int size() {
return questionLists.size();
}
public void removeQuestion(int index) {
questionLists.remove(index);
}
public String toString() {
String text = title;
for (int i = 0 ; i < questionLists.size() ; i++) {
text += "\n" + (1 + i) + ". " + questionLists.get(i).toString();
}
return text;
}
public void setSubjectname(String subjectname) {
this.subjectname = subjectname;
}
}