-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTest.java
106 lines (85 loc) · 3.27 KB
/
Test.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import java.util.Scanner;
public class Test {
public static void f1(){
boolean querying = true;
try ( //Our input scanner
Scanner scan = new Scanner(System.in)) {
while(querying)
{
//Print the menu
System.out.println();
System.out.println("#################################");
System.out.println("Please select a query below!");
System.out.println("1. User Login and Booking");
System.out.println("2. User SignUp ");
System.out.println("3. Admin Login");
System.out.println("4. Exit");
System.out.println("#################################");
System.out.println();
System.out.println("Enter Your Choice");
String input = scan.nextLine();
int answer;
try{
answer=Integer.valueOf(input);
}
catch(Exception e)
{
answer=-1;
}
if(answer == -1 || answer < 1 || answer > 4)
{
//User entered incorrect input
System.out.println("Incorrect Input!");
System.out.println("Please enter a number 1-4");
}
else if (answer==1){
Login L = new Login();
L.log(scan);
}
else if (answer==2){
Signup S= new Signup();
S.sign(scan);
}
else if (answer==3){
System.out.println("Verfiy Yourself as Admin");
System.out.println("UserId");
String userId= scan.nextLine();
int val;
try{
val=Integer.valueOf(userId);
}
catch(Exception e)
{
val=-1;
}
System.out.println("Password");
String pass = scan.nextLine();
System.out.println(pass);
AdminVerify AV= new AdminVerify();
if (val==AV.getUserId() && pass.equals(AV.getPassword()))
{
Adminpage ap= new Adminpage();
ap.adpage(scan);
}
else{
System.out.println("Incorrect Username or Password");
}
}
else if (answer == 4)
{
querying = false;
}
}
}
catch (Exception e)
{
System.out.println(e);
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Welcome to the Washing Machine Purchasing Program!");
f1();
System.out.println("Thanku for Visiting");
}
}