Class SavingAccount

java.lang.Object
com.dada.banking_project.models.Accounts.Account
com.dada.banking_project.models.Accounts.SavingAccount

@Entity public class SavingAccount extends Account
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 Details

  • Method Details

    • setInterestRate

      public void setInterestRate(BigDecimal interestRate)
      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

      public BigDecimal getInterestRate()
    • setMinimumBalance

      public void setMinimumBalance(BigDecimal minimumBalance)
      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

      public BigDecimal getMinimumBalance()