You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
990 B
36 lines
990 B
package model;
|
|
|
|
import java.io.Serializable;
|
|
|
|
public class Question implements Serializable {
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
private String question;
|
|
private String[] options;
|
|
private int correctAnswer;
|
|
private String difficulty;
|
|
|
|
public Question(String question, String[] options, int correctAnswer, String difficulty) {
|
|
this.question = question;
|
|
this.options = options;
|
|
this.correctAnswer = correctAnswer;
|
|
this.difficulty = difficulty;
|
|
}
|
|
|
|
// Getters
|
|
public String getQuestion() { return question; }
|
|
public String[] getOptions() { return options; }
|
|
|
|
|
|
public boolean isCorrect(int selectedAnswer) {
|
|
return selectedAnswer == correctAnswer;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "Question{" +
|
|
"question='" + question + '\'' +
|
|
", difficulty='" + difficulty + '\'' +
|
|
'}';
|
|
}
|
|
} |