Skip to content

Commit a6de887

Browse files
author
AmiyahJo
committed
fix: businessCheckingAccount allows the name of the business to be included
1 parent 1ab73e9 commit a6de887

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lesson_17/bank/bank_app/src/test/java/com/codedifferently/lesson17/bank/BusinessCheckingAccount.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22
import java.util.Set;
33

44
public class BusinessCheckingAccount extends CheckingAccount{
5-
private final boolean isBusinessOwner;
5+
private final String businessName;
66

7-
public BusinessCheckingAccount(String accountNumber, Set<Customer> owners, boolean isBusinessOwner) {
7+
public BusinessCheckingAccount(String accountNumber, Set<Customer> owners, String businessName) {
88
super(accountNumber, owners, 0.0);
9-
this.isBusinessOwner = isBusinessOwner;
9+
this.businessName = businessName;
1010
}
1111

12-
public void writeCheck(double amount) {
13-
if(!isBusinessOwner) {
14-
throw new IllegalArgumentException("Must be a business owner to write a check.");
15-
}
16-
super.writeCheck(amount);
17-
}
12+
public String getBusinessName() {
13+
return businessName;
14+
}
1815
}

0 commit comments

Comments
 (0)