-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdmin.java
More file actions
104 lines (90 loc) · 2.6 KB
/
Admin.java
File metadata and controls
104 lines (90 loc) · 2.6 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
import java.util.*;
class Admin extends Info
{
Scanner sc= new Scanner(System.in);
protected String pass= "123456";
void addEmployee(String n, String p)
{
employeeMap.put(n, p);
employeeAttendance.put(n,0);
ename[l]=n;
Admin.p[l]=0;
a[l]=0;
l++;
}
void removeEmployee(String n)
{
System.out.print("Enter 'YES' to remove employee- ");
String c= sc.nextLine();
if(employeeMap.size()==0)
{
System.out.println("No employees present.");
}
else if(c.compareToIgnoreCase("yes")==0)
{
employeeMap.remove(n);
}
}
void addEmployer(String n, String p)
{
employerMap.put(n, p);
}
void removeEmployer(String n)
{
System.out.print("Enter 'YES' to remove employee- ");
String c= sc.nextLine();
if(employerMap.size()==0)
{
System.out.println("No employers present.");
}
if(c.compareToIgnoreCase("yes")==0)
{
employerMap.remove(n);
}
}
void employeeDisp()
{
Iterator employeeMapIterator = employeeMap.entrySet().iterator();
while (employeeMapIterator.hasNext()) {
Map.Entry mapElement
= (Map.Entry)employeeMapIterator.next();
// Printing mark corresponding to string entries
System.out.println(mapElement.getKey() + " : "
+ mapElement.getValue());
}
}
void employerDisp()
{
Iterator employerMapIterator = employerMap.entrySet().iterator();
while (employerMapIterator.hasNext()) {
Map.Entry mapElement
= (Map.Entry)employerMapIterator.next();
// Printing mark corresponding to string entries
System.out.println(mapElement.getKey() + " : "
+ mapElement.getValue());
}
}
void changePass()
{
String s;
System.out.print("Enter current password- ");
s=sc.next();
if(s.compareTo(pass)==0)
{
//System.out.println();
System.out.print("Enter new password- ");
s=sc.next();
System.out.print("Confirm new password- ");
if(s.compareTo(sc.next())==0)
{
pass=s;
}
else{
System.out.println("Passwords does not match.");
}
}
else{
System.out.print("WRONG PASSWORD");
}
}
}