|
@@ -4,52 +4,61 @@ package rocks.zipcode.quiz5.objectorientation.account;
|
4
|
4
|
* @author leon on 30/12/2018.
|
5
|
5
|
*/
|
6
|
6
|
public class Employee implements Worker, Transactable {
|
|
7
|
+ private BankAccount bankAccount;
|
|
8
|
+ private Double hoursWorked;
|
|
9
|
+ private Double hourlyWage;
|
|
10
|
+
|
7
|
11
|
public Employee() {
|
|
12
|
+ this.bankAccount = new BankAccount();
|
|
13
|
+ this.hoursWorked = 0D;
|
|
14
|
+ this.hourlyWage = 35D;
|
8
|
15
|
}
|
9
|
16
|
|
10
|
17
|
public Employee(BankAccount bankAccount) {
|
|
18
|
+ this();
|
|
19
|
+ this.bankAccount = bankAccount;
|
11
|
20
|
}
|
12
|
21
|
|
13
|
22
|
public BankAccount getBankAccount() {
|
14
|
|
- return null;
|
|
23
|
+ return bankAccount;
|
15
|
24
|
}
|
16
|
25
|
|
17
|
26
|
public void setBankAccount(BankAccount bankAccount) {
|
18
|
|
-
|
|
27
|
+ this.bankAccount = bankAccount;
|
19
|
28
|
}
|
20
|
29
|
|
21
|
30
|
@Override
|
22
|
31
|
public void increaseHoursWorked(Double numberOfHours) {
|
23
|
|
-
|
|
32
|
+ this.hoursWorked += numberOfHours;
|
24
|
33
|
}
|
25
|
34
|
|
26
|
35
|
@Override
|
27
|
36
|
public Double getHoursWorked() {
|
28
|
|
- return null;
|
|
37
|
+ return hoursWorked;
|
29
|
38
|
}
|
30
|
39
|
|
31
|
40
|
@Override
|
32
|
41
|
public Double getHourlyWage() {
|
33
|
|
- return null;
|
|
42
|
+ return hourlyWage;
|
34
|
43
|
}
|
35
|
44
|
|
36
|
45
|
@Override
|
37
|
46
|
public Double getMoneyEarned() {
|
38
|
|
- return null;
|
|
47
|
+ return hoursWorked*hourlyWage;
|
39
|
48
|
}
|
40
|
49
|
|
41
|
50
|
@Override
|
42
|
51
|
public void deposit(Double amountToIncreaseBy) {
|
43
|
|
-
|
|
52
|
+ bankAccount.deposit(amountToIncreaseBy);
|
44
|
53
|
}
|
45
|
54
|
|
46
|
55
|
@Override
|
47
|
56
|
public void withdrawal(Double amountToDecreaseBy) {
|
48
|
|
-
|
|
57
|
+ bankAccount.withdrawal(amountToDecreaseBy);
|
49
|
58
|
}
|
50
|
59
|
|
51
|
60
|
@Override
|
52
|
61
|
public Double getBalance() {
|
53
|
|
- return null;
|
|
62
|
+ return bankAccount.getBalance();
|
54
|
63
|
}
|
55
|
64
|
}
|