forked from jointheleague/IntroToJavaWorkshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuizGame.java
64 lines (31 loc) · 1.13 KB
/
QuizGame.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package day3;
import javax.swing.JOptionPane;
public class QuizGame {
public static void main(String[] args) {
JOptionPane.showMessageDialog(null, "time to start the math quiz!");
int score = 0;
String input1=JOptionPane.showInputDialog("what is 8 X 9?");
if (input1.equals("72")) {
JOptionPane.showMessageDialog(null, "correct");
score=score+1;
}
String input2=JOptionPane.showInputDialog("what is 1/8 of 28? (use decimals)");
if (input2.equals("3.5")) {
JOptionPane.showMessageDialog(null, "correct");
score=score+1;
String input3=JOptionPane.showInputDialog("what is 30% of 300?");
if (input3.equals("90")) {
JOptionPane.showMessageDialog(null, "correct");
score=score+1;
String input4=JOptionPane.showInputDialog("how many sides does a pentagon have?");
if (input4.equals("5")) {
JOptionPane.showMessageDialog(null, "correct");
score=score+1;
String input5=JOptionPane.showInputDialog("what is 1+1?");
if (input5.equals("window")) {
JOptionPane.showMessageDialog(null, "correct");
score=score+1;
}
JOptionPane.showInputDialog("YOUR SCORE IS"+score);
}
}}}}