Skip to content

Commit 0a014cc

Browse files
committed
Fixed set up and implementation
1 parent fc14063 commit 0a014cc

28 files changed

+1189
-1624
lines changed

lesson_17/bank/bank_app/src/main/java/com/codedifferently/lesson17/Lesson17.java

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 56 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,64 @@
11
package com.codedifferently.lesson17.bank;
22

3-
import com.codedifferently.lesson17.bank.exceptions.InsufficientFundsException;
43
import java.util.Set;
54

65
/**
7-
* Common interface for all account types. Provides a contract for basic account operations
8-
* following the Interface Segregation Principle.
6+
* Represents a bank account interface.
7+
* Defines the common operations that all account types must support.
98
*/
109
public interface Account {
11-
12-
/**
13-
* Gets the account number.
14-
*
15-
* @return The account number.
16-
*/
17-
String getAccountNumber();
18-
19-
/**
20-
* Gets the owners of the account.
21-
*
22-
* @return The set of customers who own the account.
23-
*/
24-
Set<Customer> getOwners();
25-
26-
/**
27-
* Gets the current balance of the account.
28-
*
29-
* @return The current balance.
30-
*/
31-
double getBalance();
32-
33-
/**
34-
* Deposits funds into the account.
35-
*
36-
* @param amount The amount to deposit.
37-
* @throws IllegalArgumentException if amount is negative or zero.
38-
* @throws IllegalStateException if account is closed.
39-
*/
40-
void deposit(double amount);
41-
42-
/**
43-
* Withdraws funds from the account.
44-
*
45-
* @param amount The amount to withdraw.
46-
* @throws InsufficientFundsException if insufficient funds.
47-
* @throws IllegalArgumentException if amount is negative or zero.
48-
* @throws IllegalStateException if account is closed.
49-
*/
50-
void withdraw(double amount) throws InsufficientFundsException;
51-
52-
/**
53-
* Checks if the account is closed.
54-
*
55-
* @return True if the account is closed, false otherwise.
56-
*/
57-
boolean isClosed();
58-
59-
/**
60-
* Closes the account.
61-
*
62-
* @throws IllegalStateException if account cannot be closed.
63-
*/
64-
void closeAccount();
10+
11+
/**
12+
* Gets the account number.
13+
*
14+
* @return The account number.
15+
*/
16+
String getAccountNumber();
17+
18+
/**
19+
* Gets the owners of the account.
20+
*
21+
* @return The owners of the account.
22+
*/
23+
Set<Customer> getOwners();
24+
25+
/**
26+
* Deposits funds into the account.
27+
*
28+
* @param amount The amount to deposit.
29+
* @throws IllegalArgumentException if amount is not positive.
30+
* @throws IllegalStateException if account is closed.
31+
*/
32+
void deposit(double amount);
33+
34+
/**
35+
* Withdraws funds from the account.
36+
*
37+
* @param amount The amount to withdraw.
38+
* @throws IllegalArgumentException if amount is not positive.
39+
* @throws IllegalStateException if account is closed.
40+
* @throws com.codedifferently.lesson17.bank.exceptions.InsufficientFundsException if insufficient funds.
41+
*/
42+
void withdraw(double amount) throws com.codedifferently.lesson17.bank.exceptions.InsufficientFundsException;
43+
44+
/**
45+
* Gets the balance of the account.
46+
*
47+
* @return The balance of the account.
48+
*/
49+
double getBalance();
50+
51+
/**
52+
* Closes the account.
53+
*
54+
* @throws IllegalStateException if account cannot be closed.
55+
*/
56+
void closeAccount();
57+
58+
/**
59+
* Checks if the account is closed.
60+
*
61+
* @return True if the account is closed, otherwise false.
62+
*/
63+
boolean isClosed();
6564
}

0 commit comments

Comments
 (0)