-
Notifications
You must be signed in to change notification settings - Fork 0
/
Staff.java
39 lines (33 loc) · 935 Bytes
/
Staff.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
import java.util.*;
class Staff {
private String name;
private int id;
private float salary;
private int experience;
private List<Integer> id_list = new ArrayList();
public Staff(String name, int id, int exp) {
if(id_list.contains(id))
System.out.println("ID already allocated to a staff");
else {
this.name = name;
this.id = id;
this.experience = exp;
this.salary = exp*10000;
}
}
void updateSalary(float salary, char sign) {
if(sign == '+')
this.salary+=salary;
else
this.salary-=salary;
}
void staffDetails() {
System.out.println("Name: "+name+" ID: "+id+" salary: "+salary+" Experience: "+experience);
}
int getID() {
return this.id;
}
float getSalary() {
return this.salary;
}
}