|
@@ -5,7 +5,7 @@ package rocks.zipcode.quiz5.objectorientation.account;
|
5
|
5
|
/**
|
6
|
6
|
* @author leon on 30/12/2018.
|
7
|
7
|
*/
|
8
|
|
-public class Employee implements Worker {
|
|
8
|
+public class Employee implements Worker, Transactable {
|
9
|
9
|
|
10
|
10
|
private BankAccount bankAccount;
|
11
|
11
|
private Double moneyMade;
|
|
@@ -16,7 +16,8 @@ public class Employee implements Worker {
|
16
|
16
|
}
|
17
|
17
|
|
18
|
18
|
public Employee(BankAccount bankAccount) {
|
19
|
|
-
|
|
19
|
+ this.bankAccount = bankAccount;
|
|
20
|
+ this.hourlywage = getHourlyWage();
|
20
|
21
|
}
|
21
|
22
|
|
22
|
23
|
|
|
@@ -39,7 +40,7 @@ public class Employee implements Worker {
|
39
|
40
|
|
40
|
41
|
@Override
|
41
|
42
|
public Double getHoursWorked() {
|
42
|
|
- return this.hoursworked;
|
|
43
|
+ return hoursworked;
|
43
|
44
|
}
|
44
|
45
|
|
45
|
46
|
public void setHourlyWage(Double hourlywage){
|
|
@@ -49,11 +50,26 @@ public class Employee implements Worker {
|
49
|
50
|
|
50
|
51
|
@Override
|
51
|
52
|
public Double getHourlyWage() {
|
52
|
|
- return this.hourlywage;
|
|
53
|
+ return hourlywage;
|
53
|
54
|
}
|
54
|
55
|
|
55
|
56
|
@Override
|
56
|
57
|
public Double getMoneyEarned() {
|
57
|
58
|
return this.moneyMade = hourlywage * hoursworked;
|
58
|
59
|
}
|
|
60
|
+
|
|
61
|
+ @Override
|
|
62
|
+ public void deposit(Double amountToIncreaseBy) {
|
|
63
|
+ this.moneyMade += amountToIncreaseBy;
|
|
64
|
+ }
|
|
65
|
+
|
|
66
|
+ @Override
|
|
67
|
+ public void withdrawal(Double amountToDecreaseBy) {
|
|
68
|
+ this.moneyMade -= amountToDecreaseBy;
|
|
69
|
+ }
|
|
70
|
+
|
|
71
|
+ @Override
|
|
72
|
+ public Double getBalance() {
|
|
73
|
+ return moneyMade;
|
|
74
|
+ }
|
59
|
75
|
}
|