Class SavingAccount
java.lang.Object
com.dada.banking_project.models.Accounts.Account
com.dada.banking_project.models.Accounts.SavingAccount
SavingAccount is a subclass of the Account class that represents a savings account.
The SavingAccount class contains the default interest rate, minimum balance, and maximum interest rate.
-
Constructor Summary
ConstructorDescriptionSavingAccount
(BigDecimal balance, String primaryOwner, String secondaryOwner, String status, AccountHolder accountHolder) -
Method Summary
Modifier and TypeMethodDescriptionvoid
setInterestRate
(BigDecimal interestRate) Sets the interest rate for the SavingAccount.void
setMinimumBalance
(BigDecimal minimumBalance) Sets the minimum balance for this Savings account.Methods inherited from class com.dada.banking_project.models.Accounts.Account
checkBalance, checkOwnerName, setSecretKey
-
Constructor Details
-
SavingAccount
public SavingAccount(BigDecimal balance, String primaryOwner, String secondaryOwner, String status, AccountHolder accountHolder) -
SavingAccount
public SavingAccount()
-
-
Method Details
-
setInterestRate
Sets the interest rate for the SavingAccount. If the interest rate is equal to the default interest rate, sets the interest rate to the default interest rate. If the interest rate is greater than the maximum interest rate, throws an exception. Otherwise, sets the interest rate to the given value.- Parameters:
interestRate
- the interest rate to set- Throws:
IllegalArgumentException
- if the interest rate is greater than the maximum interest rate
-
getInterestRate
-
setMinimumBalance
Sets the minimum balance for this Savings account.- Parameters:
minimumBalance
- the minimum balance to set- Throws:
IllegalArgumentException
- if the minimum balance is less than the default minimum balance for Savings accounts
-
getMinimumBalance
-