/**
 * This class will be an example of a bank account
 * 
 * @author Jeff Borland 
 * @version 3-4-8
 */
public class Account
{
    private double balance;
    private String userName;
    private final int ACCOUNT_NUM;
    private static final int STARTINGACCOUNTNUM=1111;
    private static int numOfAccnts=0;
    /**
     * We have 2 options for constructions, one w/ just user name
     */
    public Account (String userName)
    {
        this.userName=userName;
        balance=0;
        ACCOUNT_NUM=STARTINGACCOUNTNUM+numOfAccnts;
        numOfAccnts++;
 
    }    
    /**
     * The second constructor w/ both username and starting balance
     */
    public Account (double balance, String userName)
    {
        this.balance=balance;
        this.userName=userName;
        ACCOUNT_NUM=highestAccountNum;
        highestAccountNum++;        
    }
    //I want a method that the bank can use to find out 
    //how many accounts ahve been created
    public static int findNumOfAccts()
    {
        return numOfAccts;
    }
    /**
     * Returns current account balance
     */        
    public double getBalance()
    {
        return balance;
    }
    /**
     * Make a deposit of amountMoney into balance of account
     */
    public void deposit(double amountMoney)
    {
        if (amountMoney>=0)
            balance+=amountMoney;
    }
    /**
     * Withdrawal amountMoney from the account
     * returns true if they have that money(and its possible)
     * returns false otherwise
     */
    public boolean withdrawal(double amountMoney)
    {
        if (amountMoney<=balance && amountMoney>=0)
        {
            balance-=amountMoney;
            return true;
        }
        else
            return false;
    }
}



