home *** CD-ROM | disk | FTP | other *** search
/ Learn Java Now / Learn_Java_Now_Microsoft_1996.iso / JavaNow / Code / Chap09 / BankAccount / BankAccount.class (.txt) next >
Encoding:
Java Class File  |  1996-08-02  |  853 b   |  28 lines

  1. public class BankAccount {
  2.    private static int m_AIds;
  3.    private int m_nAccountId;
  4.    private double m_dBalance;
  5.  
  6.    public void Withdrawal(double dAmount) throws InsufficientFundsException {
  7.       if (this.m_dBalance < dAmount) {
  8.          throw new InsufficientFundsException(this, dAmount);
  9.       } else {
  10.          this.m_dBalance -= dAmount;
  11.       }
  12.    }
  13.  
  14.    BankAccount(double dInitialBalance) {
  15.       this.m_dBalance = dInitialBalance;
  16.       this.m_nAccountId = ++m_AIds;
  17.    }
  18.  
  19.    // $FF: renamed from: Id () int
  20.    public int method_0() {
  21.       return this.m_nAccountId;
  22.    }
  23.  
  24.    public double Balance() {
  25.       return (double)((int)(this.m_dBalance * (double)100.0F + (double)0.5F)) / (double)100.0F;
  26.    }
  27. }
  28.