aboutsummaryrefslogtreecommitdiff
path: root/Week5 Quiz/src/week5/OpenQuestion.java
blob: 4f154ea3ea000ad3cd307fb37b466e0f6057835c (plain) (blame)
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
package week5;

/**
 * Class for open questions
 * 
 * @author Camil Staps, s4498062
 */
public class OpenQuestion extends Question {
    
    private final String answer;

    public OpenQuestion(String question, String answer, int weight) {
        this.question = question;
        this.answer = answer;
        setWeight(weight);
    }
    
    public OpenQuestion(String question, String answer) {
        this.question = question;
        this.answer = answer;
    }

    @Override
    public boolean isCorrect(String answer) {
        return answer.equalsIgnoreCase(this.answer);
    }

    @Override
    public String juisteAntwoord() {
        return answer;
    }
}