-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployee.java
More file actions
62 lines (47 loc) · 963 Bytes
/
Copy pathEmployee.java
File metadata and controls
62 lines (47 loc) · 963 Bytes
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
public class Employee implements Comparable<Employee> {
private int EmpId;
private String Name;
private double Salary;
public Employee() {
EmpId = 101;
Name = "Cyberster";
Salary = 999999;
}
public Employee(int empId, String name, double salary) {
EmpId = empId;
Name = name;
Salary = salary;
}
@Override
public String toString() {
return "Employee [EmpId=" + EmpId + ", Name=" + Name + ", Salary=" + Salary + "]";
}
public int getEmpId() {
return EmpId;
}
public void setEmpId(int empId) {
EmpId = empId;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public double getSalary() {
return Salary;
}
public void setSalary(double salary) {
Salary = salary;
}
@Override
public int compareTo(Employee o) {
// TODO Auto-generated method stub
if (this.EmpId > o.EmpId)
return 1;
else if (this.EmpId < o.EmpId)
return -1;
else
return 0;
}
}