-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultiChoiceQuestion.java
More file actions
36 lines (30 loc) · 872 Bytes
/
MultiChoiceQuestion.java
File metadata and controls
36 lines (30 loc) · 872 Bytes
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
import java.util.ArrayList;
public class MultiChoiceQuestion extends Question{
public String prompt;
public ArrayList<String> choices = new ArrayList<>();
protected boolean multiChoice = true;
// default constructor
public MultiChoiceQuestion(String prompt){
super(prompt);
}
// set the choices for the question
public void setChoices(){
choices.add("Lion");
choices.add("Tiger");
choices.add("Dog");
choices.add("Rabbit");
choices.add("Turtle");
}
// return the questions (ArrayList)
public ArrayList<String> getChoices(){
return choices;
}
// return if it is multi choice question
public boolean isMultiChoice(){
return super.isMultiChoice();
}
// tostring method
public String toString(){
return super.toString();
}
}