-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStaff.java
More file actions
29 lines (23 loc) · 774 Bytes
/
Copy pathStaff.java
File metadata and controls
29 lines (23 loc) · 774 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
import java.io.Serializable;
/**
* @author Abhiram Saran
* @version 25 Jan 2020
*/
public class Staff extends Person {
public Staff(String name, int age) throws NullPointerException, IllegalArgumentException {
super(name,age);
if (name.equals(null)) throw new NullPointerException();
if (age < 0) throw new IllegalArgumentException();
}
public boolean equals(Object object) {
if (object instanceof Staff) {
return ((Staff) object).getName().equals(this.getName()) && ((Staff) object).getAge() == this.getAge();
} else return false;
}
public String toString() {
int a = getAge();
String n = getName();
String s = "Staff[" + n + ", " + a + "]";
return s;
}
}