-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathQuestion.java
More file actions
46 lines (37 loc) · 1.03 KB
/
Question.java
File metadata and controls
46 lines (37 loc) · 1.03 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
public class Question {
private String questionText;
private String[] options;
private String correctAnswer;
private String userAnswer;
public Question(String questionText, String[] options, String correctAnswer) {
this.questionText = questionText;
this.options = options;
this.correctAnswer = correctAnswer;
}
// Getters
public String getQuestionText() {
return questionText;
}
public String[] getOptions() {
return options;
}
public String getCorrectAnswer() {
return correctAnswer;
}
public String getUserAnswer() {
return userAnswer;
}
// Setters
public void setUserAnswer(String userAnswer) {
this.userAnswer = userAnswer;
}
public void setOptions(String[] options) {
this.options = options;
}
public void setCorrectAnswer(String correctAnswer) {
this.correctAnswer = correctAnswer;
}
public boolean isCorrect() {
return correctAnswer.equals(userAnswer);
}
}