-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccountant.java
More file actions
49 lines (40 loc) · 2.22 KB
/
Copy pathAccountant.java
File metadata and controls
49 lines (40 loc) · 2.22 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
42
43
44
45
46
47
48
49
public class Accountant extends BusinessEmployee {
public TechnicalLead teamSupported;
public Accountant(String name){
//Should start with a bonus budget of 0 and no team they are officially supporting
super(name);
bonusBudget=0;
}
public TechnicalLead getTeamSupported(){
//Should return a reference to the TechnicalLead that this Accountant is currently supporting.
// If they have not been assigned a TechnicalLead null should be returned
return teamSupported;
}
public void supportTeam(TechnicalLead lead){
//Should allow a reference to a TechnicalLead to be passed in and saved.
// Once this happens the Accountant's bonus budget should be updated to be the total of each SoftwareEngineer's base salary that reports to that TechnicalLead plus 10%.
// For example, if the TechnicalLead supports 2 SoftwareEngineers, each with a salary of 75000, the Accountant's budget should be 150000 + 15000 for a total of 165000
this.teamSupported=lead;
for (int i=0; i<lead.team.size(); i++){
this.bonusBudget+=lead.team.get(i).getBaseSalary()*1.1;
}
}
public boolean canApproveBonus(double bonus){
//Should take in a suggested bonus amount and check if there is still enough room in the budget.
// If the bonus is greater than the remaining budget, false should be returned, otherwise true.
// If the accountant is not supporting any team false should be returned.
double requestedBonus=bonus;
if (requestedBonus<=getBonusBudget()){
return true;
} else {
System.out.print(" Rejected because Budget not sufficient. ");
return false;
}
}
public String employeeStatus(){
//Should return a String representation of this Accountant that includes their ID, name,
// the size of their currently managed budget and the name of the TechnicalLead they are currently supporting.
// Example: "1 Kasey with a budget of 22500.0 is supporting Satya Nadella"
return this.toString()+" with a budget of "+ getBonusBudget()+" is supporting "+ this.getTeamSupported();
}
}