net.sourceforge.jsurveyor
Class AnswerMultipleChoice

java.lang.Object
  extended bynet.sourceforge.jsurveyor.Answer
      extended bynet.sourceforge.jsurveyor.AnswerMultipleChoice

public class AnswerMultipleChoice
extends net.sourceforge.jsurveyor.Answer

Class to model multiplechoice answers. Saves the choice a user selects.

Version:
1.0
Author:
Claus Methmann Christensen, Anders Spliid Hansen, Esben Iversen Hansen, Lars H Jensen, Marcus Overheu, Thomas Ramdal, Peter Thomsen

Constructor Summary
AnswerMultipleChoice()
          Constructor for AnswerMultipleChoice
AnswerMultipleChoice(int questionID)
          Constructor for AnswerMultipleChoice
AnswerMultipleChoice(int questionID, int choice)
          Constructor for AnswerMultipleChoice
AnswerMultipleChoice(int answerID, int questionID, int choice)
          Constructor for AnswerMultipleChoice, use through DataAccess.
 
Method Summary
 int getAnswerID()
          Returns the id of the answer
 int getChoice()
          Returns the index number of the answered choice.
 int getQuestionID()
          Returns the questionID that the answer belongs to.
 void setAnswerID(int answerID)
          Sets the id of the answer
 void setChoice(int choice)
          Sets the index number for the selected choice.
 void setQuestionID(int questionID)
          Sets the questionID that the object is an answer for.
 java.lang.String toString()
          Returns the answerID prefixed with a M to represent it is a multiplechoice.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnswerMultipleChoice

public AnswerMultipleChoice()
Constructor for AnswerMultipleChoice


AnswerMultipleChoice

public AnswerMultipleChoice(int questionID)
Constructor for AnswerMultipleChoice

Parameters:
questionID - int

AnswerMultipleChoice

public AnswerMultipleChoice(int questionID,
                            int choice)
Constructor for AnswerMultipleChoice

Parameters:
questionID - int
choice - int

AnswerMultipleChoice

public AnswerMultipleChoice(int answerID,
                            int questionID,
                            int choice)
Constructor for AnswerMultipleChoice, use through DataAccess.

Parameters:
answerID - int
questionID - int
choice - int
Method Detail

getChoice

public int getChoice()
Returns the index number of the answered choice.

Returns:
int

setChoice

public void setChoice(int choice)
Sets the index number for the selected choice.

Parameters:
choice - int
PRE condition:
the choice must be present in the question that this is an answer for.

toString

public java.lang.String toString()
Returns the answerID prefixed with a M to represent it is a multiplechoice.

Returns:
String

getQuestionID

public int getQuestionID()
Returns the questionID that the answer belongs to.

Returns:
int

setQuestionID

public void setQuestionID(int questionID)
Sets the questionID that the object is an answer for.

Parameters:
questionID - int

getAnswerID

public int getAnswerID()
Returns the id of the answer

Returns:
int

setAnswerID

public void setAnswerID(int answerID)
Sets the id of the answer

Parameters:
answerID - int