|
@@ -5,8 +5,19 @@ package rocks.zipcode.quiz5.objectorientation.account;
|
5
|
5
|
*/
|
6
|
6
|
public class Employee implements Transactable, Worker {
|
7
|
7
|
private BankAccount bankAccount;
|
|
8
|
+ private Double amountToIncreaseBy;
|
|
9
|
+ private Double amountToDecreaseBy;
|
|
10
|
+ private Double numberOfHours;
|
8
|
11
|
|
9
|
12
|
public Employee() {
|
|
13
|
+ this.numberOfHours = 0.0;
|
|
14
|
+ }
|
|
15
|
+
|
|
16
|
+ public Employee(BankAccount bankAccount, Double amountToIncreaseBy, Double amountToDecreaseBy, Double numberOfHours) {
|
|
17
|
+ this.bankAccount = bankAccount;
|
|
18
|
+ this.amountToIncreaseBy = amountToIncreaseBy;
|
|
19
|
+ this.amountToDecreaseBy = amountToDecreaseBy;
|
|
20
|
+ this.numberOfHours = numberOfHours;
|
10
|
21
|
}
|
11
|
22
|
|
12
|
23
|
public Employee(BankAccount bankAccount) {
|
|
@@ -14,23 +25,33 @@ public class Employee implements Transactable, Worker {
|
14
|
25
|
}
|
15
|
26
|
|
16
|
27
|
public BankAccount getBankAccount() {
|
17
|
|
- return null;
|
|
28
|
+
|
|
29
|
+ Employee em = new Employee();
|
|
30
|
+
|
|
31
|
+ return em.bankAccount;
|
18
|
32
|
}
|
19
|
33
|
|
20
|
34
|
public void setBankAccount(BankAccount bankAccount) {
|
21
|
35
|
|
22
|
36
|
|
|
37
|
+ this.bankAccount = bankAccount;
|
|
38
|
+
|
|
39
|
+
|
23
|
40
|
|
24
|
41
|
}
|
25
|
42
|
|
26
|
43
|
@Override
|
27
|
44
|
public void deposit(Double amountToIncreaseBy) {
|
|
45
|
+ Double ba = bankAccount.getBalance();
|
28
|
46
|
|
|
47
|
+ bankAccount.setBalance(ba + amountToIncreaseBy);
|
29
|
48
|
}
|
30
|
49
|
|
31
|
50
|
@Override
|
32
|
51
|
public void withdrawal(Double amountToDecreaseBy) {
|
|
52
|
+ Double ba = bankAccount.getBalance();
|
33
|
53
|
|
|
54
|
+ bankAccount.setBalance(ba - amountToIncreaseBy);
|
34
|
55
|
}
|
35
|
56
|
|
36
|
57
|
@Override
|
|
@@ -41,6 +62,9 @@ public class Employee implements Transactable, Worker {
|
41
|
62
|
@Override
|
42
|
63
|
public void increaseHoursWorked(Double numberOfHours) {
|
43
|
64
|
|
|
65
|
+ Employee em = new Employee();
|
|
66
|
+
|
|
67
|
+
|
44
|
68
|
}
|
45
|
69
|
|
46
|
70
|
@Override
|