-
Notifications
You must be signed in to change notification settings - Fork 0
/
Employee.java
59 lines (51 loc) · 1.29 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
public abstract class Employee {
String firstName;
String lastName;
int id;
Employee() {
this.firstName = "plony";
this.lastName = "almony";
this.id = 0;
}
Employee(String _firstName, String _lastName, int _id) {
this.firstName = _firstName;
this.lastName = _lastName;
this.id = _id;
}
void SetFirstName(String _firstName) {
this.firstName = _firstName;
}
void SetLastName(String _lastName) {
this.lastName = _lastName;
}
void SetId(int _id) {
this.id = _id;
}
String GetFirstName() {
return this.firstName;
}
String GetLastName() {
return this.lastName;
}
int GetId() {
return this.id;
}
@Override
public String toString() {
return "firstName: " + this.firstName + ", lastName: " + this.lastName + ", id: " + Integer.toString(this.id);
}
@Override
public boolean equals(Object obj){
if (obj == null)
return false;
if (obj == this)
return true;
if (!obj.getClass().isAssignableFrom(this.getClass()))
return false;
Employee emp = (Employee) obj;
if(this.firstName == emp.firstName && this.lastName == emp.lastName && this.id == emp.id)
return true;
return false;
}
abstract float earnings();
}