Package entity

Class SavingsAccount


public class SavingsAccount extends AbstractAccount
Represents a savings account with a minimum balance constraint. Extends the AbstractAccount class.
Author:
TAMIL
See Also:
  • Field Details

    • branch_id

      private final int branch_id
    • MIN_BALANCE

      private static final BigDecimal MIN_BALANCE
  • Constructor Details

  • Method Details

    • getBranchId

      public int getBranchId()
      Gets the branch ID where the account is held.
      Specified by:
      getBranchId in class AbstractAccount
      Returns:
      the branch ID
    • canWithdraw

      public boolean canWithdraw(BigDecimal amount)
      Checks if withdrawal is allowed, enforcing minimum balance.
      Overrides:
      canWithdraw in class AbstractAccount
      Parameters:
      amount - amount to withdraw
      Returns:
      true if withdrawal is allowed; false otherwise
    • toString

      public String toString()
      Overrides:
      toString in class Object