/**
 * A bank account has a balance that can be changed by 
 * deposits and withdrawals.
 *   @author  Dave Reed (based on code by Cay Horstmann)
 *   @version 1/20/08
 */
public class BankAccount {  
   private double balance;
   
   /**
    * Constructs a bank account with a zero balance.
    */
   public BankAccount() {   
      this.balance = 0.0;
   }

   /**
    * Constructs a bank account with a given balance.
    *   @param initialBalance the initial balance
    */
   public BankAccount(double initialBalance) {   
      this.balance = initialBalance;
   }

   /**
    * Gets the current balance of the bank account.
    *   @return the current balance
    */
   public double getBalance() {   
      return this.balance;
   }

  /**
   * Deposits money into the bank account.
   *   @param amount the amount to deposit
   */
   public void deposit(double amount) {  
      this.balance = this.balance + amount;
   }

   /**
    * Withdraws money from the bank account.
    *   @param amount the amount to withdraw
    */
   public void withdraw(double amount) {   
      this.balance = this.balance - amount;
   }
}
