home *** CD-ROM | disk | FTP | other *** search
- public class InsufficientFundsException extends Exception {
- private BankAccount m_ba;
- private double m_dWithdrawalAmount;
-
- InsufficientFundsException(BankAccount ba, double dAmount) {
- super("Insufficient funds in account ");
- this.m_ba = ba;
- this.m_dWithdrawalAmount = dAmount;
- }
-
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append("Insufficient funds in account ");
- sb.append(this.m_ba.Id());
- sb.append("\nBalance was ");
- sb.append(this.m_ba.Balance());
- sb.append("\nWithdrawal was ");
- sb.append(this.m_dWithdrawalAmount);
- return sb.toString();
- }
- }
-