Class ShortAnswerQuestion

java.lang.Object
  extended by ShortAnswerQuestion

public class ShortAnswerQuestion
extends java.lang.Object

This is the Question which accepts only short answer. Short answer is one word.

Author:
Mario KuĊĦek

Field Summary
private  java.lang.String correctAnswer
          Correct answer of the question.
private  java.lang.String text
          Text of question.
 
Constructor Summary
ShortAnswerQuestion(java.lang.String text, java.lang.String correctAnswer)
          Constructs question with text and answer.
 
Method Summary
 java.lang.String getText()
          Returns text of the question.
 boolean isCorrectAnswer(java.lang.String answer)
          Checks if the answer is correct.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

text

private java.lang.String text
Text of question.


correctAnswer

private java.lang.String correctAnswer
Correct answer of the question.

Constructor Detail

ShortAnswerQuestion

public ShortAnswerQuestion(java.lang.String text,
                           java.lang.String correctAnswer)
Constructs question with text and answer.

Parameters:
text - a text of the question
correctAnswer - a correct answer to the question
Method Detail

getText

public java.lang.String getText()
Returns text of the question.

Returns:
text of the question

isCorrectAnswer

public boolean isCorrectAnswer(java.lang.String answer)
Checks if the answer is correct.

Parameters:
answer - the answer that needs to be checked
Returns:
true if it is correct, false otherwise