Phase IV
- Added BankAcctAppGUI as a GUI frontend to replace CLI - Enhanced DataEntry to use Regex patterns for input validation
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/* Phase III */
|
||||
/* Phase IV */
|
||||
|
||||
package bankAcctApp;
|
||||
|
||||
// Class representing checking accounts
|
||||
//Class representing checking accounts
|
||||
public class CheckingAccount extends Account {
|
||||
|
||||
// Overridden method for withdrawals in checking accounts
|
||||
@@ -14,29 +14,30 @@ public class CheckingAccount extends Account {
|
||||
}
|
||||
setBalance(newBalance); // Update balance
|
||||
}
|
||||
|
||||
|
||||
// Overridden method for deposits in checking accounts
|
||||
@Override
|
||||
public void deposit(double amount) {
|
||||
setBalance(getBalance() + amount - getSvcFee()); // Add amount and deduct service fee
|
||||
}
|
||||
|
||||
|
||||
// Overridden method for applying accrued interest in checking accounts
|
||||
@Override
|
||||
public double applyAccruedInterest(String transactionDate) {
|
||||
double interest = 0.0;
|
||||
if (getBalance() <= 0.0) { // Ensure balance is positive for interest accrual
|
||||
if (getBalance() <= 0.0) { // Ensure balance is positive for interest accrual
|
||||
System.out.println("This account has an insufficient balance for interest to apply.");
|
||||
} else {
|
||||
interest = getBalance() * (getInterestRate() / 100); // Calculate interest
|
||||
setBalance(getBalance() + interest); // Add interest to the balance
|
||||
logTransaction(transactionDate, "INT", interest); // Log the interest transaction
|
||||
interest = getBalance() * (getInterestRate() / 100); // Calculate interest
|
||||
setBalance(getBalance() + interest); // Add interest to the balance
|
||||
logTransaction(transactionDate, "INT", interest); // Log the interest transaction
|
||||
}
|
||||
return interest;
|
||||
return interest;
|
||||
}
|
||||
// Implementation of balance() method from AccountInterface
|
||||
@Override
|
||||
public double balance() {
|
||||
return getBalance(); // Return the current balance
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user