-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExec.java
More file actions
211 lines (200 loc) · 7.76 KB
/
Exec.java
File metadata and controls
211 lines (200 loc) · 7.76 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
import java.net.SocketTimeoutException;
import java.util.*;
abstract class Info
{
static HashMap<String,String> employeeMap=new HashMap<String,String>();
static HashMap<String,String> employerMap=new HashMap<String,String>();
static HashMap<String,Integer> employeeAttendance= new HashMap<String,Integer>();
static String leave[][]= new String [100][3];
static String ename[]= new String[100];
static int p[]= new int[100];
static int a[]= new int[100];
static int l=0;
static int s=0;
}
class Exec
{
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
Admin a= new Admin();
Employee e= new Employee();
Employer b=new Employer();
String password;
String uid;
int choice;
int c;
String reason;
System.out.println("Initial Admin password is '123456'.\nIt is recommended to change the password as soon as possible.");
System.out.println();
do{
//System.out.println();
//System.out.println();
System.out.println("===============LOGIN===============");
System.out.print("Enter 1 for Admin, ");
System.out.print ("2 for Employee, ");
System.out.print("3 for Employer and -1 to exit- ");
choice = sc.nextInt();
switch(choice){
case 1:
System.out.println("Enter the Admin password");
password= sc.next();
if(password.compareTo(a.pass)==0){
//System.out.println("===============WELCOME===============");
//System.out.println();
System.out.println();
//System.out.println();
System.out.println("===============WELCOME TO ADMIN PAGE===============");
do{
System.out.println("\n");
System.out.print("Enter 1 to add employee, 2 to remove employee, 3 to add employer, 4 to remove employer, \n5 to view employee details, 6 to view employer details, 7 to change password, and -1 to exit- ");
System.out.println();
c=sc.nextInt();
switch(c)
{
case 1:
System.out.print("Enter username- ");
uid= sc.next();
System.out.print("Enter password- ");
password=sc.next();
a.addEmployee(uid, password);
break;
case 2:
System.out.print("Enter username- ");
uid=sc.next();
a.removeEmployee(uid);
break;
case 3:
System.out.print("Enter username- ");
uid= sc.next();
System.out.print("Enter password- ");
password=sc.next();
a.addEmployer(uid, password);
break;
case 4:
System.out.print("Enter username- ");
uid=sc.next();
a.removeEmployee(uid);
break;
case 5:
a.employeeDisp();
break;
case 6:
a.employerDisp();
break;
case 7:
a.changePass();
break;
case -1:
System.out.println("THANK YOU");
System.out.println();
System.out.println();
break;
default:
System.out.println("INVALID CHOICE. TRY AGAIN.");
break;
}
}while(c!=-1);
}
else{
System.out.println("Incorrect password");
}
break;
case 2:
System.out.println("Enter user id- ");
uid = sc.next();
System.out.println("Enter the Employee password");
password= sc.next();
if(password.compareTo(e.employeeMap.get(uid))==0){
// System.out.println("===============WELCOME===============");
// System.out.println();
System.out.println();
//System.out.println();
System.out.println("===============WELCOME TO EMPLOYEE PAGE===============");
do{
System.out.println();
System.out.print("Enter 1 to request leave, 2 to review leave status, 3 to view attendance and-1 to exit- ");
System.out.println();
c=sc.nextInt();
switch(c)
{
case 1:
System.out.println("Enter reason for leave- ");
sc.nextLine();
reason=sc.nextLine();
e.Requestleave(uid, reason, "PENDING");
break;
case 2:
e.ReviewLeave(uid);
break;
case 3:
e.viewAttendance(uid);
break;
case -1:
System.out.println("THANK YOU");
System.out.println();
System.out.println();
break;
default:
System.out.println("INVALID CHOICE. TRY AGAIN.");
break;
}
}while(c!=-1);
}
else{
System.out.println("Wrong password entered.");
}
break;
case 3:
System.out.println("Enter user id- ");
uid = sc.next();
System.out.println("Enter the Employee password");
password= sc.next();
if(password.compareTo(b.employerMap.get(uid))== 0){
// System.out.println("===============WELCOME===============");
// System.out.println();
System.out.println();
//System.out.println();
System.out.println("===============WELCOME TO EMPLOYER PAGE===============");
do{
System.out.println();
System.out.print("Enter 1 to addAttendance, 2 to review leaves and -1 to exit- ");
System.out.println();
c=sc.nextInt();
System.out.println();
switch(c)
{
case 1:
b.addAttendance();
break;
case 2:
b.leaveRec();
break;
case 3:
b.emp_disp_all();
break;
case -1:
System.out.println("THANK YOU");
System.out.println();
System.out.println();
break;
default:
System.out.println("INVALID CHOICE. TRY AGAIN.");
System.out.println();
break;
}
}while(c!=-1);
}
else{
System.out.println("Wrong password entered.");
}
break;
case -1:
System.out.println();
System.out.println("===============Program Ended===============");
break;
default:
System.out.println("INVALID CHOICE. TRY AGAIN");
}
}while(choice!=-1);
}
}