home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-06-20 | 717 b | 25 lines |
- public class InsufficientFundsException extends Exception
- {
- private BankAccount m_ba; // account with problem
- private double m_dWithdrawalAmount;
-
- InsufficientFundsException(BankAccount ba, double dAmount)
- {
- super("Insufficient funds in account ");
- m_ba = ba;
- m_dWithdrawalAmount = dAmount;
- }
-
- public String toString()
- {
- StringBuffer sb = new StringBuffer();
- sb.append("Insufficient funds in account ");
- sb.append(m_ba.Id());
- sb.append("\nBalance was ");
- sb.append(m_ba.Balance());
- sb.append("\nWithdrawal was ");
- sb.append(m_dWithdrawalAmount);
- return sb.toString();
- }
- }
-