/
QuizQuestion.java
52 lines (46 loc) · 1.19 KB
/
QuizQuestion.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
/**
* @author Natampalli, Ashwin
* 19SP CS-170-01 (076011) (Hybrid)
* Final Project
* Due Date: May 15, 2019
*/
/**
* This class represents the quiz questions, the associated answer choices, and the correct answer.
*/
public class QuizQuestion {
private final String question;
private final int correctAnswerIndex;
private final String[] answers;
/**
* Constructor
* @param question
* @param correctAnswerIndex
* @param answers
*/
public QuizQuestion(String question, int correctAnswerIndex, String[] answers) {
this.question = question;
this.correctAnswerIndex = correctAnswerIndex;
this.answers = answers;
}
/**
* Returns the question string
* @return question
*/
public String getQuestion() {
return question;
}
/**
* Returns the answer for the associated question
* @return answer
*/
public String getCorrectAnswer() {
return answers[correctAnswerIndex];
}
/**
* Returns the multiple choice answers
* @return answers
*/
public String[] getAnswers() {
return answers;
}
}