public class PermanentAccount extends Account
balance
of
represented accounts is negative, which cannot be sidestepped because the
possibility of offline withdrawals is mandatoryaccountNumber, transactions
Constructor and Description |
---|
PermanentAccount(int accountNumber,
int balance) |
Modifier and Type | Method and Description |
---|---|
int |
accountBalance() |
boolean |
balanceIsAccessible() |
boolean |
newWithdrawalIsPossible(int amount)
Determine whether a certain amount of money may be withdrawn.
|
void |
requestStatement()
Request a printed account statement.
|
void |
sendAccountStatement()
Simulate the sending of an account statement ...
|
java.lang.String |
toString() |
void |
withdraw(int amount)
Withdraw
amount from the account
TODO: should the premiss "clock.isEarlier(clock.instance.currentDate,
dateOfLatestWithdrawal)" rather be made some kind of invariant? |
addTransaction, checkAndWithdraw, flushTransactions, getAccountNumber, getTransactions, transactionListToString
public void withdraw(int amount)
amount
from the account
TODO: should the premiss "clock.isEarlier(clock.instance.currentDate,
dateOfLatestWithdrawal)" rather be made some kind of invariant?public void requestStatement()
requestStatement
in class Account
public boolean balanceIsAccessible()
balanceIsAccessible
in class Account
true
iff the balance of this account can be
determined (not possible for the offline situation)public int accountBalance()
accountBalance
in class Account
public boolean newWithdrawalIsPossible(int amount)
PermanentAccount.withdraw(int,int)
it is possible to
circumvent this check, which is necessary because for offline withdrawals
the balance cannot be accessed and checkednewWithdrawalIsPossible
in class Account
amount
- the amount of money requestedtrue
iff amount
can be withdrawn
from the accountpublic void sendAccountStatement()
public java.lang.String toString()
toString
in class java.lang.Object