-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestionAnswer.java
More file actions
77 lines (63 loc) · 1.26 KB
/
QuestionAnswer.java
File metadata and controls
77 lines (63 loc) · 1.26 KB
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
75
76
77
import java.util.ArrayList;
/** class QuestionAnswer
* This class contains all the member variables and methods required by a question.
*/
public class QuestionAnswer
{
private String question;
private String[] options;
private Integer solution;
private Integer userChoice;
QuestionAnswer()
{
question = new String();
options = new String[4];
}
QuestionAnswer(String quest, String[] opt, int sol)
{
this.question = quest;
this.options = opt;
this.solution = sol;
}
public String getQuestion()
{
return this.question;
}
public String[] getOptions()
{
return this.options;
}
public Integer getSolution()
{
return this.solution;
}
public Integer getUserChoice()
{
return this.userChoice;
}
public void setQuestion(String quest)
{
this.question = quest;
}
public void setOptions(String[] opt)
{
this.options = opt;
}
public void setSolution(Integer sol)
{
this.solution = sol;
}
public void setUserChoice(Integer choice)
{
this.userChoice = choice;
}
public String toString()
{
String formatS = new String();
for (int i=0; i<this.options.length; i++)
{
formatS += ((i+1) + ". " + this.options[i] + "\t");
}
return formatS;
}
}