/**
 * A bank account class with a balance
 */
public class BankAcct1
{    
    private double balance;
    
    /**
     * Get the balance of this account
     * @return this account's balance
     */
    public double getBalance()
    {
        return balance;
    }
    
    /**
     * Deposit positive amount into this account
     * @param amount the amount to deposit
     */
    public void deposit(double amount)
    {
        if (amount < 0)
        {
            System.out.println("Error: unable to deposit negative amount.");
        }
        else
        {
            balance += amount;
        }
    }
    
    /**
     * Withdraw positive amount from this account
     * @param amount the amount to withdraw
     */
    public void withdraw(double amount)
    {
        if (amount < 0)
        {
            System.out.println("Error: unable to withdraw negative amount.");
        }
        else
        {
            balance -= amount;
        }
    }
    
    /**
     * Get a String representation of this bank account
     * @return The string representation of this BankAcct
     */
    public String toString()
    {
        return "[balance: " + String.format("%.2f", balance) + "]";
    }
}
