Class ChequingAccount


  • public class ChequingAccount
    extends AbstractAccount
    This class implements a simple model of a chequing account
    Version:
    1.1
    Author:
    George Kriger
    See Also:
    AbstractAccount
    • Constructor Summary

      Constructors 
      Constructor Description
      ChequingAccount​(int accountNum, double initialBalance, double costPerCheque)
      ChequingAccount constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cheque​(double amount)
      will decrease the account balance by the amount provided by the parameter
      also decrease the balance by the cost per cheque (given at construction time)
      the running total of service charges is increased by the amount of the cost per cheque
      void deposit​(double amount)
      deposit will increase the account balance by the amount provided by the parameter balance is updated
      double getServiceCharges()  
      java.lang.String toString()  
      void withdraw​(double amount)
      will decrease the account balance by the amount provided by the parameter balance is updated
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ChequingAccount

        public ChequingAccount​(int accountNum,
                               double initialBalance,
                               double costPerCheque)
        ChequingAccount constructor
        Parameters:
        accountNum - the account number
        initialBalance - the initial balance
        costPerCheque - the service charge for each cheque
    • Method Detail

      • deposit

        public void deposit​(double amount)
        deposit will increase the account balance by the amount provided by the parameter balance is updated
        Specified by:
        deposit in class AbstractAccount
        Parameters:
        amount - how much to deposit into the account
      • withdraw

        public void withdraw​(double amount)
        will decrease the account balance by the amount provided by the parameter balance is updated
        Specified by:
        withdraw in class AbstractAccount
        Parameters:
        amount - how much to withdraw from the account
      • getServiceCharges

        public double getServiceCharges()
        Returns:
        the total dollar amount of service charges (e.g. cost per cheque)
      • cheque

        public void cheque​(double amount)
        will decrease the account balance by the amount provided by the parameter
        also decrease the balance by the cost per cheque (given at construction time)
        the running total of service charges is increased by the amount of the cost per cheque
        Parameters:
        amount - how much to remove from the account
      • toString

        public java.lang.String toString()
        Specified by:
        toString in class AbstractAccount
        Returns:
        formatted representation of account