-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSoftwareDeveloper.java
More file actions
41 lines (34 loc) · 1.32 KB
/
SoftwareDeveloper.java
File metadata and controls
41 lines (34 loc) · 1.32 KB
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
package workers;
public class SoftwareDeveloper extends Employee {
private double monthlyBonus;
private EmployeeType employeeType = EmployeeType.SOFTWARE_DEVELOPER;
public SoftwareDeveloper(String id, String firstName, String lastName, String phoneNumber, String emailAddress,
Gender gender, double basicMonthlySalary, double monthlyBonus) {
super(id, firstName, lastName, phoneNumber, emailAddress, gender, basicMonthlySalary);
setMonthlyBonus(monthlyBonus);
this.employeeType = EmployeeType.SOFTWARE_DEVELOPER;
}
public double getMonthlyBonus() {
return monthlyBonus;
}
public void setMonthlyBonus(double monthlyBonus) {
if (monthlyBonus > 0) {
this.monthlyBonus = monthlyBonus;
} else {
throw new IllegalArgumentException("Monthly bonus cannot be negative.");
}
}
@Override
public double calculateMonthlyIncome() {
return getBasicMonthlySalary() + monthlyBonus;
}
@Override
public String toString() {
return super.toString() + ", Employee Type: " + employeeType + ", Monthly Bonus: $" + monthlyBonus;
}
@Override
public boolean equals(Object other) {
return (other instanceof SoftwareDeveloper)
&& super.equals(other);
}
}