Skip to content

Commit 86c7783

Browse files
author
AmiyahJo
committed
feat: adds account interface , checkNotAllowedException , etc.
added an extra import `set` for businessCheckingAccount , and changed the name of the exception in savings account
1 parent 010b8b6 commit 86c7783

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.codedifferently.lesson17.bank;
2+
3+
public interface Account {
4+
void deposit(double account);
5+
void withdraw(double amount);
6+
double getBalance();
7+
String getAccountNumber();
8+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package com.codedifferently.lesson17.bank;
2+
import java.util.Set;
23

34
public class BusinessCheckingAccount extends CheckingAccount{
45
private final boolean isBusinessOwner;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.codedifferently.lesson17.bank;
2+
3+
public class CheckNotAllowedException extends RuntimeException {
4+
public CheckNotAllowedException(String message) {
5+
super(message);
6+
}
7+
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ public SavingsAccount(String accountNumber, Set<Customer> owners, double initial
77
super(accountNumber, owners, initialBalance);
88
}
99

10-
1110
public void writeCheck(double amount) {
12-
throw new UnsuportedOperationException("Savings account cannot write checks");
11+
throw new CheckNotAllowedException("Savings account cannot write checks");
1312
}
1413
}

0 commit comments

Comments
 (0)