/**
 * Representation for an interest-bearing savings account
 * 
 * @author Russell C. Bjork 
 * @version November 18, 2009
 */
public class SavingsAccount extends BankAccount
{
    private static double annualInterestRate;
    
    /**
     * Constructor for objects of class SavingsAccount
     * 
     * @param owner the owner of this account
     * 
     * The account number will be set to the first available unused number
     * The balance will be set to zero
     */
    public SavingsAccount(Customer owner)
    {
        super(owner);
    }

    /**
     * Pay interest for one month.
     */
    public void payInterest()
    {
        if (currentBalance >= MINIMUM_AMOUNT_FOR_INTEREST)
            currentBalance += (int) (currentBalance * annualInterestRate / 12.0);
    }
    
    /**
     * Modify the interest rate
     *
     * @param newRate the new annual interest rate
     */
    public static void setAnnualInterestRate(double newRate)
    {
        annualInterestRate = newRate;
    }
    
    /** The minimum balance an account can have and still receive interest
     */
    public static final int MINIMUM_AMOUNT_FOR_INTEREST = 500;
}
