// TS8802 Project by John Phillips on 6/24/2003 last revised 6/26/2003

// All question/answer problems inherit from this abstract class.

public abstract class Problem {
  private String question;
  private String answer;

  public Problem()
  {
  }

  public void setQuestion( String q )
  {
    question = q;
  }

  public String getQuestion()
  {
    return question;
  }

  public void setAnswer( String a )
  {
    answer = a.toUpperCase();
  }

  public String getAnswer()
  {
    return answer;
  }

  public String toString()
  {
    return "Question: " + getQuestion() + "\nAnswer: " + getAnswer();
  }

  public boolean checkIt( String studentAnswer )
  {
    if( answer.equals(studentAnswer.toUpperCase()) )
      return true;
    else
      return false;
  }

  public String hint()
  {
    return "Sorry, there is no hint for this problem type. " +
      "Please see your instructor for help.";
  }

  public abstract void newProblem();
}