Java Reference
In-Depth Information
LISTING 7.9
//********************************************************************
// Question.java Author: Lewis/Loftus
//
// Represents a question (and its answer).
//********************************************************************
public class
Question
implements
Complexity
{
private
String question, answer;
private int
complexityLevel;
//-----------------------------------------------------------------
// Constructor: Sets up the question with a default complexity.
//-----------------------------------------------------------------
public
Question (String query, String result)
{
question = query;
answer = result;
complexityLevel = 1;
}
//-----------------------------------------------------------------
// 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;
}
Search WWH ::
Custom Search