Jeopardy Game

 

We together are going to create a Portland trivia jeopardy game.

 

Using the abstract class below:

In groups of 2, Create a class that will extend this class (name the class anything you want):

The class:

  • have a constructor taking in difficulty (an int 1-5)
  • have getQuestion which will return a question (depending on difficulty)
  • have checkAnswer which will return if answer is correct (depending on difficulty)
  • have categoryDescription which will return the category

So if your class is called Restaurants, I might do this:

Restaurants q1=new Restaurant(1);
print out (q1.getQuestion());  //This might look like:  What street is Deering on?  1. Brighton 2. Woodfords 3.Stevens 4.Forest     [this would be one of 5 questions depending on difficulty]
print out--- q1.categoryDescription()
checks---  q1.checkAnswer(3)  //this would return true if 3 is the correct answer

    


public abstract class Question {
	private boolean isUsed=false;
	private int difficulty;
	
	public Question(int difficulty) {
		this.difficulty = difficulty;		
	}
	
	public boolean isUsed() {
		return isUsed;
	}
	
	public void setUsed() {
		this.isUsed = true;
	}

	public int getDifficulty() {
		return difficulty;
	}
	
	//Check answer will take an answer and depending on difficulty 
	//(which determines which question was used, will return true if answer is correct
	public abstract boolean checkAnswer(int answer);

	//Will return the question (and answer choices) depending on difficulty 
	public abstract String getQuestion();

	//will return the category description (always the same for any difficulty
	public abstract String getCategoryDescription();
	
}


NOTE: ALL ANSWERS MUST BE INTS