forked from shubhammehra4/Gift-Items-JDBC-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
92 lines (77 loc) · 3.16 KB
/
Main.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
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
import java.util.Scanner;
class Main {
public static void driver() {
boolean running = true;
try (Scanner scan = new Scanner (System.in) ) {
while (running) {
System.out.println();
System.out.println ("Choose one of these options:");
System.out.println();
System.out.println ("\t1. Login & Shop");
System.out.println ("\t2. User Register");
System.out.println ("\t3. Admin Login");
System.out.println ("\t4. Exit");
String input = scan.nextLine();
int answer;
try {
answer = Integer.valueOf (input);
} catch (Exception e) {
answer = -1;
}
switch (answer) {
case 1:
System.out.println ("Login Page");
// Login Page
Login L = new Login();
L.execute(scan);
break;
case 2:
System.out.println ("Register Page");
// Register Page
Register R = new Register();
R.execute (scan);
break;
case 3:
System.out.println ("Admin Login");
// Admin Login
AdminVerify ad = new AdminVerify();
String username = ad.getUserId();
String password = ad.getPassword();
String UserString = scan.nextLine();
String UserPassword = scan.nextLine();
System.out.println("user:" + UserString + "," + username);
System.out.println("pass:" + UserPassword + "," + password);
System.out.println("af" + (UserString == username) + (UserPassword == password));
if (UserString.equals(username) && UserPassword.equals(password)) {
Adminpage pg = new Adminpage();
pg.adpage(scan);
} else {
System.out.println("Admin credentials could not be verified");
}
break;
case 4:
running = false;
break;
default:
System.out.println ("Incorrect Input!");
System.out.println ("Please enter a Number between 1-4");
}
// Clear Console
// System.out.print("\033[H\033[2J");
// System.out.flush();
System.out.println();
}
} catch (Exception e) {
System.out.println ("Something went wrong");
} finally {
System.out.println ("Thanks for visiting us! ");
System.out.println ("Hope to see you again soon");
System.out.println ("Bye!");
}
}
public static void main (String[] args) {
System.out.println ("###############################");
System.out.println ("\t\t\tWelcome");
driver();
}
}