Class Account

java.lang.Object
Account

public class Account
extends java.lang.Object
Superclass of bank account hierarchy.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected int acct_no
    The account number de hoy.
    protected java.lang.String ss
    The social security number of owner.
  • Constructor Summary

    Constructors 
    Constructor Description
    Account()  
    Account​(int id, double amt, java.lang.String ss)
    Constructor Account.
  • Method Summary

    Modifier and Type Method Description
    double balance()
    Retrieves the account balance.
    void deposit​(double amt)
    Deposits into account.
    boolean withdraw​(double amt)
    Withdraw from account.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • acct_no

      protected int acct_no
      The account number de hoy.
    • ss

      protected java.lang.String ss
      The social security number of owner.
  • Constructor Details

    • Account

      public Account()
    • Account

      public Account​(int id, double amt, java.lang.String ss)
      Constructor Account. Initializes a new account.
      Parameters:
      id - Account number
      amt - Initial balance amount
      ss - Social security number as string
  • Method Details

    • balance

      public double balance()
      Retrieves the account balance.
      Returns:
      the balance
    • deposit

      public void deposit​(double amt)
      Deposits into account.
      Parameters:
      amt - the amount to deposit, if amt <=0 no effect
    • withdraw

      public boolean withdraw​(double amt)
      Withdraw from account.
      Parameters:
      amt - the amount to deposit
      Returns:
      false if amt <=0 or insufficient balance