-
Notifications
You must be signed in to change notification settings - Fork 0
/
FillBlankQ.java
44 lines (30 loc) · 1.04 KB
/
FillBlankQ.java
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
35
36
37
38
39
40
41
42
43
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication3;
/**
*
* @author shammaaas
*/
public class FillBlankQ extends Question{ //implements Serializable{
private String correctAnswer;
public FillBlankQ(String text, String qID, double pGrade, String correctAnswer){
super (text, qID, pGrade);
this.correctAnswer = correctAnswer;
}
public FillBlankQ(Question q){//ctor
this(q.text, q.qID, q.pGrade, ((FillBlankQ) q).correctAnswer);
}
public String formattedQ(){
return String.format("Fill the follwing blank:%n%s:%s%n",this.qID,this.text);
}
public String formattedQwithA(){
return String.format("%sCorrect Answer is: %s%n",formattedQ(),correctAnswer);
}
public void setCorrectAnswer(String correctAnswer){
this.correctAnswer = correctAnswer;}
public String getCorrectAnswer(){
return correctAnswer;}
}