All pastes #953179 Raw Edit

question

public java v1 · immutable
#953179 ·published 2008-03-22 21:23 UTC
rendered paste body
//********************************************************************//  Question.java       Author: Lewis/Loftus////  Solution to Programming Project 6.10 & 6.11////********************************************************************public class Question{   private String question, answer;   private int complext;   private int complexityLevel;   //-----------------------------------------------------------------   //  Sets up the question with a default complexity.   //-----------------------------------------------------------------   public Question (String query, String result)   {      question = query;      answer = result;      complexityLevel = 1;   }      public Question (String query, String result, int complext){	question = query;	answer = result;	complexityLevel = complext;	}	   //-----------------------------------------------------------------   //  Sets the complexity level for this question.   //-----------------------------------------------------------------   public void setComplexity (int level)   {      complexityLevel = level;   }   //-----------------------------------------------------------------   //  Returns the complexity level for this question.   //-----------------------------------------------------------------   public int getComplexity()   {      return complexityLevel;   }   //-----------------------------------------------------------------   //  Returns the question.   //-----------------------------------------------------------------   public String getQuestion()   {      return question;   }   //-----------------------------------------------------------------   //  Returns the answer to this question.   //-----------------------------------------------------------------   public String getAnswer()   {      return answer;   }   //-----------------------------------------------------------------   //  Returns true if the candidate answer matches the answer.   //-----------------------------------------------------------------   public boolean answerCorrect (String candidateAnswer)   {      return answer.equals(candidateAnswer);   }   //-----------------------------------------------------------------   //  Returns this question (and its answer) as a string.   //-----------------------------------------------------------------   public String toString()   {      return question + "\n" + answer;   }}