aboutsummaryrefslogtreecommitdiff
path: root/Week5 Quiz/src/week5/TCQuestion.java
diff options
context:
space:
mode:
Diffstat (limited to 'Week5 Quiz/src/week5/TCQuestion.java')
-rw-r--r--Week5 Quiz/src/week5/TCQuestion.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/Week5 Quiz/src/week5/TCQuestion.java b/Week5 Quiz/src/week5/TCQuestion.java
new file mode 100644
index 0000000..f89240c
--- /dev/null
+++ b/Week5 Quiz/src/week5/TCQuestion.java
@@ -0,0 +1,40 @@
+package week5;
+
+/**
+ * Class for 2-choice questions
+ *
+ * Note: for 3+-choice questions one can use MCQuestion.
+ *
+ * @author Camil Staps, s4498062
+ */
+public class TCQuestion extends MCQuestion {
+
+ /**
+ * Construct a new TCQuestion instance
+ *
+ * @param question the question
+ * @param answer1 the first answer
+ * @param answer2 the second answer
+ * @param correctAnswer 0 if answer1 is correct, 1 if answer2 is correct
+ * @param weight the weight for this question
+ */
+ public TCQuestion (String question, String answer1, String answer2, int correctAnswer, int weight) {
+ super(question, new String[] {answer1, answer2}, correctAnswer, weight);
+ }
+
+ /** See the javadoc on the constructor above */
+ public TCQuestion (String question, String answer1, String answer2, int correctAnswer) {
+ super(question, new String[] {answer1, answer2}, correctAnswer);
+ }
+
+ /**
+ * For TCQuestions we don't need to randomize the answers.
+ *
+ * @return the new question
+ */
+ @Override
+ public Question duplicate() {
+ return this;
+ }
+
+}