Created
December 7, 2016 10:59
-
-
Save voquanghoa/93d3d5d705d8ab1d9d2fdb3d09635b50 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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