
/**
 * Account.java
 *
 *
 * Created: Wed Sep 18 21:15:16 2002
 *
 * @author <a href="mailto: "</a>
 * @version
 */

public class Account implements AccountInterface{
   //Data: Account number
   int accountNum;
   double balance;
   String owner;

   //constructor
   // for simplicity we have a single constructor that initializes
   // all the data
   // you could also have individual set methods for eash of the data
   public Account (int acctNum, String name, double bal){
      accountNum = acctNum;
      balance = bal;
      owner = name;
   }

   public void deposit(double amt)
   {
      balance = balance + amt;
      // not returning the balance to be true to the realworld deposit
      // transaction: "unless you specifically ask for it they won't
      // give you the balance when you deposit"

   }
   
   public double withdraw(double amt) throws InsufficientFundsException
   {
      if ( amt > balance) {
	 throw new InsufficientFundsException(" Amount > Balance");
      } // end of if ()
      else {
	 balance = balance - amt;
      } // end of else
      return balance;
   }

   public double inquireBalance()
   {
      return balance;
   } 
   //

   public boolean matchAcctNum (int acct)
   {
      return (acct == accountNum);
   }
}// Account

