Repository navigation
Expand file tree
/
Copy pathaddition quiz.txt
More file actions
107 lines (76 loc) · 3.3 KB
/
Copy pathaddition quiz.txt
File metadata and controls
107 lines (76 loc) · 3.3 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package se2025;
import java.util.Scanner;
public class Se2025 {
public static void main(String[]args){
System.out.print("Welcome to Mathematic basic addition exam");
System.out.print(" we will ask you five addition questions.");
System.out.print(" the number are between zero to hundred.\n");
System.out.print(" you have fifty seconds to answer to this questions.\n");
System.out.print("to be success in the exam atleast answer three question correctly\n");
System.out.println("the first question is:");
Scanner input = new Scanner(System.in);
int num1=(int)(Math.random()*100);
int num2=(int)(Math.random()*100);
int num3=(int)(Math.random()*100);
int num4=(int)(Math.random()*100);
int num5=(int)(Math.random()*100);
int num6=(int)(Math.random()*100);
int num7=(int)(Math.random()*100);
int num8=(int)(Math.random()*100);
int num9=(int)(Math.random()*100);
int num10=(int)(Math.random()*100);
int correct =0;
System.out.println("What is "+num1+"+"+num2+" =?");
int answer1 =input.nextInt();
if(answer1==num1+num2){
System.out.print("\n");
correct++;
}
System.out.println("What is "+num3+"+"+num4+"=?");
int answer2 = input.nextInt();
if(answer2==num3+num4){
System.out.print("\n");
correct++;}
System.out.println("what is "+num5+"+"+num6+" =?");
int answer3=input.nextInt();
if(answer3==num5+num6){
System.out.print("\n");
correct++;}
System.out.println("what is "+num7+"+"+num8+" =?");
int answer4=input.nextInt();
if(answer4==num7+ num8){
System.out.print("\n");
correct++;}
System.out.println("what is "+num9+"+"+num10+" =?");
int answer5 = input.nextInt();
if(answer5==num9+ num10){
System.out.print("\n");
correct++;}
System.out.println("your correct answer are ("+correct+") answer(s)");
if(correct>=3)
System.out.println("congratulation! You pass the exam successfully");
else
System.out.println("Sorry you fail the exam");
int wrong =0;
if(answer1!=num1+num2){
System.out.print("your first answer was wrong\n");
System.out.print(" the correct answer is "+(num1+num2)+"\n");
wrong++;}
if(answer2!=num3+num4){
System.out.print("your second answer was also wrong\n");
System.out.print("the correct answer is "+(num3+num4)+"\n"); wrong++;}
if(answer3!=num5+num6){
System.out.print("your third answer was also wrong\n");
System.out.print(" the correct answer is "+(num5+num6)+"\n");
wrong++;}
if(answer4!=num7+num8){
System.out.print("your forth answer was also wrong \n");
System.out.print(" the correct answer is "+(num7+num8)+"\n");
wrong++; } if(answer5!=num9+num10){
System.out.print("your fifth answer was also wrong\n");
System.out.print("the correct answer is "+(num9+num10)+"\n");
wrong++;}
}
}
}
}