Skip to content

Instantly share code, notes, and snippets.

@voquanghoa voquanghoa/ss.java
Created Dec 7, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.