|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--bank.Account
Field Summary | |
protected IDs.Id |
acctNum
|
protected double |
balance
|
protected java.lang.String |
PIN
|
Constructor Summary | |
Account()
Creates a new instance of Account takes defaults for balance (0) and interest rate, but no value for acct number |
|
Account(java.lang.String pin,
double bal)
Creates a new instance of Account - with random acct number and other given info about the account |
|
Account(java.lang.String acct,
java.lang.String pin,
double bal)
Creates a new instance of Account - given info about the account |
Method Summary | |
int |
compareTo(java.lang.Object obj)
Compares two accounts - needed for sorting - required since implements Comparable interface Don't show until we cover interfaces returns negative if object comparing to is less, zero if object comparing to is equal, positive if object comparing to is greater MAR - I have made the call that accounts should be compared based on their acct number |
boolean |
deposit(double amt)
deposit a given amount into the calling Account |
double |
depositEx(double amt)
deposit a given amount into the calling Account returns the new balance Exception Handling version - do not show until exception handling covered |
boolean |
equals(bank.Account toCompare)
determine if a passed account has the same contents as the calling object (account number, PIN, AND balance) Overrides version in java.lang.Object |
IDs.Id |
getAcctID()
return the account number as an ID |
java.lang.String |
getAcctNum()
return the account number as a string |
double |
getBal()
return the current balance - basically an account inquiry |
java.lang.String |
getPin()
report the PIN |
static void |
main(java.lang.String[] args)
|
boolean |
matchAcctNum(bank.Account toCompare)
determine if a passed account has the same account number as the calling object (does not worry about whether the id matches on required length or whether there is a check digit - if the string matches, this matches |
boolean |
matchAcctNum(java.lang.String toCompare)
determine if a passed string is the correct account number for the calling object |
boolean |
setAcctId(IDs.Id acctNumber)
set account number, given an id - should probably only be used publically at the creation of the account. |
boolean |
setAcctNum(java.lang.String acctNumber)
set account number, given a string - should probably only be used publically at the creation of the account. |
boolean |
setBal(double amt)
set the account balance - should probably only be used publicly at the creation of the account. |
boolean |
setPIN(java.lang.String pin)
set PIN - should be carefully controlled |
java.lang.String |
toString()
produce a string for an account - generally used for display Overrides version in java.lang.Object |
boolean |
withdraw(double amt)
withdraw a given amount from the calling Account |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected IDs.Id acctNum
protected java.lang.String PIN
protected double balance
Constructor Detail |
public Account()
public Account(java.lang.String pin, double bal)
public Account(java.lang.String acct, java.lang.String pin, double bal)
Method Detail |
public boolean deposit(double amt)
public double depositEx(double amt) throws bank.NegativeAmount
bank.NegativeAmount
public boolean withdraw(double amt)
public double getBal()
public java.lang.String getAcctNum()
public IDs.Id getAcctID()
public java.lang.String getPin()
public boolean setBal(double amt)
public boolean setAcctId(IDs.Id acctNumber)
public boolean setAcctNum(java.lang.String acctNumber)
public boolean setPIN(java.lang.String pin)
public boolean matchAcctNum(java.lang.String toCompare)
public boolean matchAcctNum(bank.Account toCompare)
public boolean equals(bank.Account toCompare)
public java.lang.String toString()
toString
in class java.lang.Object
public int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
public static void main(java.lang.String[] args)
args
- the command line arguments
little test driver
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |