-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmployee.java
80 lines (68 loc) · 1.61 KB
/
Employee.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
package companyManager;
public class Employee implements EmployeeInterface, Comparable<Employee>
{
private int id;
private String firstName;
private String lastName;
private String department;
public Employee(int id, String firstName, String lastName, String department)
{
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
this.department = department;
}
@Override
public int getId()
{
return this.id;
}
@Override
public String getFirstName()
{
return this.firstName;
}
@Override
public void setFirstName(String firstName)
{
this.firstName = firstName;
}
@Override
public String getLastName()
{
return this.lastName;
}
@Override
public void setLastName(String lastName)
{
this.lastName = lastName;
}
@Override
public String getDepartment()
{
return this.department;
}
@Override
public String toString()
{
return String.valueOf(getId()).concat(", ").concat(getFirstName())
.concat(" ").concat(getLastName()).concat(", ").concat(getDepartment());
}
@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (! (o instanceof Employee)) return false;
return (this.getId() == ((Employee) o).getId());
}
@Override
public int hashCode()
{
return (Integer.MAX_VALUE)/500 + getId();
}
@Override
public int compareTo(Employee other)
{
return (this.getId() - other.getId());
}
}