-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBack.java
More file actions
84 lines (54 loc) · 2.03 KB
/
Back.java
File metadata and controls
84 lines (54 loc) · 2.03 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
import java.util.Random;
import java.util.Scanner;
public class Back {
Random rand = new Random();
Scanner scan = new Scanner(System.in);
private int x;
private int y;
private String isim;
private String soyad;
public Back(String isim, String soyad) {
this.isim = isim;
this.soyad = soyad;
this.x = kes.nextInt(29);
this.y = kes.nextInt(29);
String name = "name"; //----> User's username and surname infos
String surname = "username";
if (this.isim == name && this.soyad == surname) {
System.out.println("What is the result? " + x + " + " + y);
int a = scan.nextInt();
if (a == x + y) {
System.out.println("Access Granted");
System.out.println("Welcome to the system");
}
else {
//int b;
for (int b = 5;; b++) {
System.out.println("Try it again");
x = rand.nextInt(30-1);
y = rand.nextInt(30-1);
System.out.println("What is the result? " + x + " + " + y);
int i = scan.nextInt();
if (i == x + y) {
System.out.println("Access Granted");
System.out.println("Human verification completed");
System.out.println("Welcome to the system");
break;
}
else if (b == 10) {
System.out.println("Access Denied");
System.out.println("You're not a human!");
break;
}
else {
continue;
}
}
}
}
else {
System.out.println("Access Denied");
}
scan.close();
}
}