Package BankAccountPkg
Class ChequingAccount
- java.lang.Object
-
- BankAccountPkg.AbstractAccount
-
- BankAccountPkg.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
-
-
Field Summary
-
Fields inherited from class BankAccountPkg.AbstractAccount
accountNum, balance
-
-
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 voidcheque(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 chequevoiddeposit(double amount)deposit will increase the account balance by the amount provided by the parameter balance is updateddoublegetServiceCharges()java.lang.StringtoString()voidwithdraw(double amount)will decrease the account balance by the amount provided by the parameter balance is updated-
Methods inherited from class BankAccountPkg.AbstractAccount
getBalance
-
-
-
-
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:
depositin classAbstractAccount- 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:
withdrawin classAbstractAccount- 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:
toStringin classAbstractAccount- Returns:
- formatted representation of account
-
-