title: Java program to demonstrate abstract BankAccount class and SavingsAccount subclass
body: <p>This week I was tasked with writing an abstract BankAccount class and a SavingsAccount class which extends BankAccount. I have written out the code as the assignment asks and it seems to compile perfectly. I now must write a driver to test the two classes and here is where I am stuck.. Just to be clear I'm not asking anyone to write it for me, I want to eventually be able to do this all on my own. I'm just asking for a little guidance. (I've scheduled one on one time with my instructor and he has cancelled twice) </p>
  
  <p>I basically am wondering how to write the driver class for these two classes.
  Are my classes missing anything in terms of fields or methods? How do you seasoned programmers plan out this kind of stuff? </p>
  
  <p>Any suggestions you may have would be appreciated!</p>
  
  <pre><code>public abstract class BankAccount
  {
    double balance;
    int numOfDeposits;
    int numOfWithdraws;
    double interestRate;
    double annualInterest;
    double monSCharges;
    double amount;
    double monInterest;
  
    //constructor accepts arguments for balance and annual interest rate
    public BankAccount(double bal, double intrRate)
    {
      balance = bal;
      annualInterest = intrRate;
    }
  
    //sets amount
     public void setAmount(double myAmount)
      {
          amount = myAmount;
      }
  
    //method to add to balance and increment number of deposits
    public void deposit(double amountIn)
    {
      balance = balance + amountIn;
      numOfDeposits++;
    }
  
    //method to negate from balance and increment number of withdrawals
    public void withdraw(double amount)
    {
      balance = balance - amount;
      numOfWithdraws++;
    }
  
    //updates balance by calculating monthly interest earned
    public double calcInterest()
    {
      double monRate;
  
      monRate= interestRate / 12;
      monInterest = balance * monRate;
      balance = balance + monInterest;
      return balance;
    }
  
    //subtracts services charges calls calcInterest method sets number of withdrawals and deposits
    //and service charges to 0
    public void monthlyProcess()
    {
      calcInterest();
      numOfWithdraws = 0;
      numOfDeposits = 0;
      monSCharges = 0;
    }
  
    //returns balance
    public double getBalance()
    {
      return balance;
    }
  
    //returns deposits
    public double getDeposits()
    {
      return numOfDeposits;
    }
  
    //returns withdrawals
    public double getWithdraws()
    {
      return numOfWithdraws;
    }
  }
  </code></pre>
  
  <p>and the subclass</p>
  
  <pre><code>public class SavingsAccount extends BankAccount
  {
    //sends balance and interest rate to BankAccount constructor
    public SavingsAccount(double b, double i)
    {
      super(b, i);
    }
  
    //determines if account is active or inactive based on a min acount balance of $25
    public boolean isActive()
    {
      if (balance &gt;= 25)
        return true;
      return false;
    }
  
    //checks if account is active, if it is it uses the superclass version of the method
    public void withdraw()
    {
      if(isActive() == true)
      {
        super.withdraw(amount);
      }
    }
  
    //checks if account is active, if it is it uses the superclass version of deposit method
    public void deposit()
    {
      if(isActive() == true)
      {
        super.deposit(amount);
      }
    }
  
    //checks number of withdrawals adds service charge
    public void monthlyProcess()
    {
      if(numOfWithdraws &gt; 4)
        monSCharges++;
    }
  }
  </code></pre>