-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestion.java
More file actions
34 lines (29 loc) · 1008 Bytes
/
Copy pathQuestion.java
File metadata and controls
34 lines (29 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import java.awt.Image;
import javax.swing.ImageIcon;
public abstract class Question {//abstract question class
private int worth;
private static int numOfQuestionsAnswered = 0;
ImageIcon backOfCard;
public Question(int points) {
worth = points;
backOfCard = new ImageIcon(getClass().getResource(this.worth + ".jpg"));//gets picture of jeopardy card
Image image = backOfCard.getImage();
Image newImage = image.getScaledInstance(100, 50, Image.SCALE_SMOOTH);//controls size of button
backOfCard = new ImageIcon(newImage);
}
public int getPoints() {
return worth; //returns worth of question
}
public int getAnswered() {
return numOfQuestionsAnswered;//returns how many questions have been answered
}
public void answered() {
numOfQuestionsAnswered++;//increases the number of questions answered
}
public ImageIcon getBackOfCard() {
return backOfCard;
}
//abstract methods
abstract String getAnswer();
abstract String getQuestion();
}