
package banking.primitive.core;

public abstract class Account implements java.io.Serializable {
    private static final long serialVersionUID = 1L;

    protected enum State {
        OPEN, CLOSED, OVERDRAWN
    };

    protected float balance = 0.0F;
    protected String name;
    private State state;
    
    /**
    Method: Account
    Inputs: n
    Returns: N/A

    Description: Constructor to create account using just the name as an argument
  */
    protected Account(String n) {
        name = n;
        state = State.OPEN;
    }

    /**
    Method: Account
    Inputs: n, b
    Returns: N/A

    Description: Constructor to create account based on name and balance.
  */
    protected Account(String n, float b) {
        this(n); 
        balance = b;
    }

    /**
    Method: getName
    Inputs: N/A
    Returns: name

    Description: Returns the name of the account.
    */
    public final String getName() {
        return name;
    }

    /**
    Method: getBalance
    Inputs: N/A
    Returns: balance

    Description: Returns the balance of the account.
    */
    public final float getBalance() {
        return balance;
    }
    
    /**
    Method: deposit
    Inputs: amount
    Returns: True/False

    Description: Adds money to an account. May not be done if the account is CLOSED
    */
    public abstract boolean deposit(float amount);

    /**
     * Takes money out of an account. If the balance falls below 0 then the
     * account is moved to an OVERDRAWN state
     * 
     * @param parameter
     *            amount is a withdrawal and must be > 0
     * @return true if the deposit was successful, false if not due to amount or
     *         invalid state
     */
    
    /**
    Method: withdraw
    Inputs: amount
    Returns: True/False

    Description: Takes money out of an account. If the balance falls below 0 then the 
    account is moved to an OVERDRAWN state
    */
    public abstract boolean withdraw(float amount);

    /**
    Method: getType
    Inputs: N/A
    Returns: type

    Description: Returns the type of the account
  */
    public abstract String getType();
    
    /**
    Method: getState
    Inputs: N/A
    Returns: state

    Description: Returns the state of the account
    */
    protected final State getState() {
        return state;
    }
    
    /**
    Method: setState
    Inputs: s
    Returns: N/A

    Description: Sets the state of the account.
    */
    protected final void setState(State s) {
        state = s;
    }

    /**
    Method: toString
    Inputs: N/A
    Returns: A string containing the name, balance and state of the account.

    Description: Returns a string containing the name, balance and state of the account.
    */
    public String toString() {
        return "Account " + name + " has $" + balance + "and is " + getState()
                + "\n";
    }
}


/*
 * File: Account.java
 * Author: kevingary
 * Date: Unknown
 * 
 * Description: Contains generic account methods
 */


package banking.primitive.core;

public abstract class Account implements java.io.Serializable {
    private static final long serialVersionUID = 1L;

    protected enum State {
        OPEN, CLOSED, OVERDRAWN
    };

    protected float balance = 0.0F;
    protected String name;
    private State state;

    protected Account(String n) {
        name = n;
        state = State.OPEN;
    }

    protected Account(String n, float b) {
        this(n); 
        balance = b;
    }

    /**
     * @return name of the Account
     */
    public final String getName() {
        return name;
    }

    /**
     * @return balance in the Account
     */
    public final float getBalance() {
        return balance;
    }

    /**
     * Adds money to an account. May not be done if the account is CLOSED
     * 
     * @param parameter
     *            amount is a deposit and must be > 0
     * @return true if the deposit was successful, false if not due to amount or
     *         invalid state
     */
    public abstract boolean deposit(float amount);

    /**
     * Takes money out of an account. If the balance falls below 0 then the
     * account is moved to an OVERDRAWN state
     * 
     * @param parameter
     *            amount is a withdrawal and must be > 0
     * @return true if the deposit was successful, false if not due to amount or
     *         invalid state
     */
    public abstract boolean withdraw(float amount);

    /**
     * @return either "Checking" or "Savings"
     */
    public abstract String getType();

    protected final State getState() {
        return state;
    }

    protected final void setState(State s) {
        state = s;
    }

    public String toString() {
        return "Account " + name + " has $" + balance + "and is " + getState()
                + "\n";
    }
}


@@ -3014,2048 +3014,4 @@
 %0A%7D%0D%0A
-%0D%0A%0D%0A/*%0D%0A * File: Account.java%0D%0A * Author: kevingary%0D%0A * Date: Unknown%0D%0A * %0D%0A * Description: Contains generic account methods%0D%0A */%0D%0A%0D%0A%0D%0Apackage banking.primitive.core;%0D%0A%0D%0Apublic abstract class Account implements java.io.Serializable %7B%0D%0A    private static final long serialVersionUID = 1L;%0D%0A%0D%0A    protected enum State %7B%0D%0A        OPEN, CLOSED, OVERDRAWN%0D%0A    %7D;%0D%0A%0D%0A    protected float balance = 0.0F;%0D%0A    protected String name;%0D%0A    private State state;%0D%0A%0D%0A    protected Account(String n) %7B%0D%0A        name = n;%0D%0A        state = State.OPEN;%0D%0A    %7D%0D%0A%0D%0A    protected Account(String n, float b) %7B%0D%0A        this(n); %0D%0A        balance = b;%0D%0A    %7D%0D%0A%0D%0A    /**%0D%0A     * @return name of the Account%0D%0A     */%0D%0A    public final String getName() %7B%0D%0A        return name;%0D%0A    %7D%0D%0A%0D%0A    /**%0D%0A     * @return balance in the Account%0D%0A     */%0D%0A    public final float getBalance() %7B%0D%0A        return balance;%0D%0A    %7D%0D%0A%0D%0A    /**%0D%0A     * Adds money to an account. May not be done if the account is CLOSED%0D%0A     * %0D%0A     * @param parameter%0D%0A     *            amount is a deposit and must be %3E 0%0D%0A     * @return true if the deposit was successful, false if not due to amount or%0D%0A     *         invalid state%0D%0A     */%0D%0A    public abstract boolean deposit(float amount);%0D%0A%0D%0A    /**%0D%0A     * Takes money out of an account. If the balance falls below 0 then the%0D%0A     * account is moved to an OVERDRAWN state%0D%0A     * %0D%0A     * @param parameter%0D%0A     *            amount is a withdrawal and must be %3E 0%0D%0A     * @return true if the deposit was successful, false if not due to amount or%0D%0A     *         invalid state%0D%0A     */%0D%0A    public abstract boolean withdraw(float amount);%0D%0A%0D%0A    /**%0D%0A     * @return either %22Checking%22 or %22Savings%22%0D%0A     */%0D%0A    public abstract String getType();%0D%0A%0D%0A    protected final State getState() %7B%0D%0A        return state;%0D%0A    %7D%0D%0A%0D%0A    protected final void setState(State s) %7B%0D%0A        state = s;%0D%0A    %7D%0D%0A%0D%0A    public String toString() %7B%0D%0A        return %22Account %22 + name + %22 has $%22 + balance + %22and is %22 + getState()%0D%0A                + %22%5Cn%22;%0D%0A    %7D%0D%0A%7D%0D%0A%0D%0A

Update Account.java