Create two subclasses for checking and saving accounts. A checking account has an overdraft limit but a savings account cannot be overdrawn
<p>Account class was defined to model a bank account. An account has the properties account number, balance, annual interest rate, and date created, and methods to deposit and withdraw funds.</p>

<p>Now Create two subclasses for checking and saving accounts. A checking account has an overdraft limit(say $1,000 with a $25 fee charged), but a savings account cannot be overdrawn.</p>

<p>Write a test program that creates objects of Account, SavingsAccount, and CheckingAccount and invokes their toString() method.</p>

<p>Above are the instructions and below is my code. I cannot figure out how to invoke the  subclasses into the main Account Class. I would also like to know how the toString() method can be applied because I cannot get that either. I also kept most of my comments in my code where I was trying different ideas. </p>

<hr>

<pre><code>/* 

//Calls both subclasses to the main. As well as a few other variables.  
SavingsAccount savings = new SavingsAccount();
CheckingAccount checking = new CheckingAccount();
Account account;


    double balance = 0.0;
    double withdrawal = 0.0;
    double deposit = 0.0;

    System.out.println(checking);
    CheckingAccount.getwithdrawal(10.50);
    System.out.println(savings);
    SavingsAccount.deposit(5.0);
    System.out.println(account);
     }    
}

 */

 package account;



  public class Assignment5  {

   SavingsAccount savings = new SavingsAccount();
   CheckingAccount checking = new CheckingAccount();
   Account account;

   public static void main (String[] args) {
   Account account = new Account(1122, 20000);

  /* System.out.print("After Creation,  " );
   Print (account.getBalance());
  Account.setAnnualInterestRate(4.5);
   System.out.print("After Withdrawal of $2,500,  " );
   account.withdraw(2500);
   Print (account.getBalance());
    System.out.print("After Deposit of $3,000,  " );
    account.deposit(3000);
   Print (account.getBalance());
    System.out.println("Balance is " + account.getBalance());
    System.out.println("Monthly interest is " +
  account.getMonthlyInterest());
    System.out.println("This account was created at " +
  account.getDateCreated()); */

    } 
  // Extra Print Method
     public static void Print (double x){
     System.out.printf("The current balance is "+" $ "+"%4.2f"+"%n",x);
    }
  }



  class Account {
  private int id;
   double balance;
   private static double annualInterestRate;
   private java.util.Date dateCreated;

  public Account() {
    dateCreated = new java.util.Date();
  }

  public Account(int newId, double newBalance) {
     id = newId;
     balance = newBalance;
     dateCreated = new java.util.Date();
   }

  public int getId() {
    return this.id;
      }

   public double getBalance() {
    return balance;
    }

     public static double getAnnualInterestRate() {
      return annualInterestRate;
      }

    public void setId(int newId) {
     id = newId;
     }

    public void setBalance(double newBalance) {
     balance = newBalance;
     }

  public static void setAnnualInterestRate(double newAnnualInterestRate) {
    annualInterestRate = newAnnualInterestRate;
  }

 public double getMonthlyInterest() {
   return balance * (annualInterestRate / 1200);
 }

  public java.util.Date getDateCreated() {
   return dateCreated;
  }

   public void withdraw(double amount) {
    balance -= amount;
 }

    public void deposit(double amount) {
    balance += amount;
   }
  }
</code></pre>

<hr>

<pre><code> package account;

 public class CheckingAccount extends Account {


double overDraft = -1000;

    public void checking(double i) {

        //initializes double variable balance as 0.0
        double balance = 0.0;
        if (balance - i &lt; overDraft){
                System.out.println("Failure: Can't overdraft more than            $1,000. A $25 +"
                        + "overdraft fee will be issued to your account. ");
             balance = balance - 25; }
        else
            balance = balance - i;
      }   
  }
</code></pre>

<hr>

<pre><code>  package account;

  public class SavingsAccount extends Account{
    double overdraftLimit = 0;

    public void withdraw (double w) {
        if (balance - w &lt; overdraftLimit)
                System.out.println("Insufficient Funds");
        else
            balance = balance - w;
    }
}
</code></pre>