/**
 * A "bank" Account that allows the owner to withdraw more money
 * than is in the account 
 *
 * @version 1.0
 * @author  Prof. David Bernstein, James Madison University
 */
public class OverdraftAccount extends Account
{
    protected double   overdraftLimit;

    /**
     * Constructor
     *
     * @param idNumber        The ID for the Account
     * @param initialDeposit  The initial deposit
     * @param limit           The overdraft limit
     */
    public OverdraftAccount(int idNumber, 
                            double initialDeposit, double limit) 
    {
	balance = 0.0;
	
	id = idNumber;
	if (initialDeposit > 0) balance = initialDeposit;
	
	overdraftLimit = 0.0;
	if (limit > 0.0) overdraftLimit = limit;
    }

    /**
     * Determine the maximum amount that can be withdrawn
     *
     * Note: This method overrides amountAvailable() in Account.
     * This method is called by the method withdraw() which
     * is defined in Account.
     *
     * @return The size of the maximum possible withdrawal
     */
    public double amountAvailable() {

	return (balance+overdraftLimit);
    }
}
