-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathQuiz.java
48 lines (38 loc) · 1.56 KB
/
Quiz.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
44
45
46
47
48
import java.awt.event.ActionEvent;
import javax.swing.*;
import java.awt.* ;
import javax.swing.border.LineBorder;
import javax.swing.border.SoftBevelBorder;
public class Quiz {
public static void main(String[] args) throws InterruptedException {
JFrame window = new JFrame ("Quiz Game") ;
window.setSize(800,500);
window.setLocationRelativeTo(null);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setResizable(false);
while (true) {
int nbr =0 , score=0 , m=0 , s=0 ;
int time = 60 ; //sec
welcomePage welcome = new welcomePage (window);
welcome.choose(time);
quiz2 [] qObj = {
new quiz2("Question 1","op1","op2","op3","op4","op1","hint 1"),
new quiz2("Question 2","op1","op2","op3","op4","op4","hint 2"),
new quiz2("Question 3","op1","op2","op3","op4","op3","hint 3"),
new quiz2("Question 4","op1","op2","op3","op4","op2","hint 4")
};
while (nbr != qObj.length && s<time ) {
questions quiz = new questions(qObj[nbr], window);
quiz.getAnswer(time);
m = quiz.getTime().M ;
s = quiz.getTime().S ;
score = quiz.getScore();
if (nbr == qObj.length-1 || (s==time)) quiz.Reset();
nbr++ ;
}
int nbrQ = qObj.length ;
scorePane scorePane = new scorePane (window,score,nbrQ) ;
scorePane.choose();
}
}
}