Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code improvement and feature additions #123

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ A dummy application for a bank; should provide various functions of a retail ban
* **Maxi-Savings accounts** have a rate of 2% for the first $1,000 then 5% for the next $1,000 then 10%
* A bank manager can get a report showing the list of customers and how many accounts they have
* A bank manager can get a report showing the total interest paid by the bank on all accounts
* A customer can transfer between their accounts
* Interest rates should accrue daily (incl. weekends), rates above are per-annum

### Additional Features

* A customer can transfer between their accounts
* Change **Maxi-Savings accounts** to have an interest rate of 5% assuming no withdrawals in the past 10 days otherwise 0.1%
* Interest rates should accrue daily (incl. weekends), rates above are per-annum
73 changes: 0 additions & 73 deletions src/main/java/com/abc/Account.java

This file was deleted.

46 changes: 0 additions & 46 deletions src/main/java/com/abc/Bank.java

This file was deleted.

78 changes: 0 additions & 78 deletions src/main/java/com/abc/Customer.java

This file was deleted.

18 changes: 0 additions & 18 deletions src/main/java/com/abc/DateProvider.java

This file was deleted.

16 changes: 0 additions & 16 deletions src/main/java/com/abc/Transaction.java

This file was deleted.

10 changes: 10 additions & 0 deletions src/main/java/com/abc/domain/constants/AccountType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.abc.domain.constants;

/**
* The enumeration for Account Type
*
* @author Ihor
*/
public enum AccountType {
CHECKING, SAVINGS, MAXI_SAVINGS
}
29 changes: 29 additions & 0 deletions src/main/java/com/abc/domain/constants/DailyCompoundRate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.abc.domain.constants;

/**
* The daily compound rate+1 based on 365 days
*
* Following matrix was used to convert rates from non-leap year to daily 0.1%
* => 1.0000027383608262443494848243471 0.2% =>
* 1.0000054739948799896979591374816 2% => 1.0000542552451767719379729880399 5%
* => 1.0001336806171134403505084797728 10% => 1.0002611578760678121616866817054
*
* @author Ihor
*/
public interface DailyCompoundRate {
interface Checking {
static final double ANY = 1.0000027383608262443494848243471;
}

interface Savings {
static final double UNDER_1000 = 1.0000027383608262443494848243471;
static final double OVER_1000 = 1.0000054739948799896979591374816;
}

interface MaxiSavings {
static final double UNDER_1000 = 1.0000542552451767719379729880399;
static final double UNDER_2000 = 1.0001336806171134403505084797728;
static final double OVER_2000 = 1.0002611578760678121616866817054;
}

}
11 changes: 11 additions & 0 deletions src/main/java/com/abc/domain/constants/TransferState.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.abc.domain.constants;

/**
* The states to transfer between accounts
*
* @author Ihor
*/
public enum TransferState {
INITIAL, WITHDRAWN_COMPLETE

}
20 changes: 20 additions & 0 deletions src/main/java/com/abc/domain/exceptions/BusinessException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.abc.domain.exceptions;

/**
* The superclass for all business exception in Bank
*
* @author Ihor
*/
public class BusinessException extends Exception {
private static final long serialVersionUID = 7156699628264008860L;

/**
* The constructor for BusinessException
*
* @param message
* Error message
*/
public BusinessException(String message) {
super(message);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.abc.domain.exceptions;

/**
* The exception to indicate that Customer data is invalid. It is Business
* Exception subclass.
*
* @author Ihor
*/
public class InvalidCustomerException extends BusinessException {
private static final long serialVersionUID = 1827978046616513675L;

/**
* The constructor for InvalidCustomerException
*
* @param message
* Error message
*/
public InvalidCustomerException(String message) {
super(message);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
*
*/
package com.abc.domain.exceptions;

/**
* @author Ihor
*
*/
public class InvalidPeriodException extends BusinessException {

private static final long serialVersionUID = 8836080878991008928L;

/**
* Constructor to create InvalidPeriodException
*
* @param message
* Error message
*/
public InvalidPeriodException(String message) {
super(message);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.abc.domain.exceptions;

/**
* The exception to indicate that transaction is invalid. It is Business
* Exception subclass.
*
* @author Ihor
*/
public class InvalidTransactionException extends BusinessException {
private static final long serialVersionUID = 3796741547535023801L;

/**
* The constructor for InvalidTransactionException
*
* @param message
* Error message
*/
public InvalidTransactionException(String message) {
super(message);
}
}
Loading