|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object c12oop.simplequiz.lab.ShortAnswerQuestion
public class ShortAnswerQuestion
ShortAnswerQuestion implements a simple question class that encapsulates a question text (one String) and a correct answer (one String). An answer must match the answer string to be considered correct.
Constructor Summary | |
---|---|
ShortAnswerQuestion(java.lang.String text,
java.lang.String answer)
|
Method Summary | |
---|---|
boolean |
checkAnswer(java.lang.String answer)
Return true if the given answer is correct for this question. |
java.lang.String |
getAnswer()
Return the answer to this question, potentially with helpful comments. |
java.lang.String |
getQuestion()
Return the full text for this question, including the question text and any appropriate instructions |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ShortAnswerQuestion(java.lang.String text, java.lang.String answer)
Method Detail |
---|
public java.lang.String getQuestion()
public java.lang.String getAnswer()
public boolean checkAnswer(java.lang.String answer)
answer
- the user's answer
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |