-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployee.java
More file actions
30 lines (26 loc) · 882 Bytes
/
Employee.java
File metadata and controls
30 lines (26 loc) · 882 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
public class Employee implements Comparable<Employee> {
int emp_id, age;
String name, dept, location;
public Employee(String name, int age, String dept, String location) {
this.name = name;
this.age = age;
this.dept = dept;
this.location = location;
}
public Employee(int emp_id, String name, int age, String dept, String location) {
this.emp_id = emp_id;
this.name = name;
this.age = age;
this.dept = dept;
this.location = location;
}
@Override
public int compareTo(Employee e) {
return this.name.compareToIgnoreCase(e.name);
}
@Override
public String toString() {
return "id:" + this.emp_id + " name:" + this.name + " age:" + this.age +
" dept:" + this.dept + " location:" + this.location;
}
}