c12oop.simplequiz.lab
Class ShortAnswerQuestion

java.lang.Object
  extended by c12oop.simplequiz.lab.ShortAnswerQuestion

public class ShortAnswerQuestion
extends java.lang.Object

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.

Version:
8dec2009
Author:
kvlinden

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

ShortAnswerQuestion

public ShortAnswerQuestion(java.lang.String text,
                           java.lang.String answer)
Method Detail

getQuestion

public java.lang.String getQuestion()
Return the full text for this question, including the question text and any appropriate instructions

Returns:
the full question

getAnswer

public java.lang.String getAnswer()
Return the answer to this question, potentially with helpful comments.

Returns:
the answer

checkAnswer

public boolean checkAnswer(java.lang.String answer)
Return true if the given answer is correct for this question.

Parameters:
answer - the user's answer
Returns:
true if and only if the given answer is correct