package cz.muni.fi.bronchus.questions; import java.util.Vector; /** * Standard Multiple Choice question, with some amount of answers and one is correct * @author Tomáš Udržal */ public class MultipleChoiceQuestion extends Question { /** * correct answer indexed as the letter 'A'..'Z' */ protected String correctAnswer; /** * Vector of answers */ private Vector answers; /** * Shuffle order of answers */ private boolean shuffle; /** Creates a new instance of MultipleChoiceQuestion */ public MultipleChoiceQuestion() { super("Multiple Choice"); correctAnswer=""; answers=new Vector(); shuffle=false; } /** * Setter method for the correct answer * @param x letter 'A'..'Z' */ public void setCorrectAnswer(String x) { correctAnswer=x; } /** * Getter method for the correct answer * @return letter 'A'..'Z' */ public String getCorrectAnswer() { return correctAnswer; } /** * Adds an answer to the end of the Vector * @param x answer to be added */ public void addAnswer(String x) { answers.add(x); } /** * Getter method for the Vector of answers * @return Vector of answers */ public Vector getAnswers() { return answers; } /** * Setter method for the shuffle order of answers * @param x true if shuffle is enabled otherwise false */ public void setShuffle(boolean x) { shuffle=x; } /** * Getter method for the shuffle order of answers * @return true if shuffle is enabled otherwise false */ public boolean isShuffle() { return shuffle; } /** * Method for generating a response processing condition from a selected answers * @return response processing condition */ public String generateCondition() { String s=null; s=correctAnswer+"==true"; return s; } }