Skip to content

Instantly share code, notes, and snippets.

@voquanghoa
Created December 7, 2016 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save voquanghoa/93d3d5d705d8ab1d9d2fdb3d09635b50 to your computer and use it in GitHub Desktop.
Save voquanghoa/93d3d5d705d8ab1d9d2fdb3d09635b50 to your computer and use it in GitHub Desktop.
package voon.truongvan.chines_exercise.model;
import java.util.ArrayList;
/**
* Created by Vo Quang Hoa on 12/22/2015.
*/
public class Question {
private String question;
private ArrayList<String> answers;
private int correct;
public String getQuestion() {
if(question==null){
question = "";
}
return question;
}
public boolean checkCorrectAnswer(int index) {
return correct == index;
}
public String getAnswer(int index){
if(answers!=null && answers.size()>index){
return answers.get(index);
}
return "";
}
public boolean hasAnswer(int i){
String answer = getAnswer(i);
return answer!=null && answer.length()>0;
}
public void setAnswers(ArrayList<String> answers) {
this.answers = answers;
}
public void setCorrect(int correct) {
this.correct = correct;
}
public int getCorrect() {
return correct;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment