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