previous | start | next

Example: BankApp.java

public class BankApp
{
  
  public static void main(String[] args)
  {
    BankAccount b1 = new BankAccount(1000);
    BankAccount b2 = new BankAccount(20000);
    SavingsAccount s1 = new SavingsAccount(500, 2.5);

    b1.deposit(100);
    b2.deposit(1000);
    s1.postInterest();
    s1.deposit(100);

    System.out.println(b1);
    System.out.println(b2);
    System.out.println(s1);

  }

Sample run:

java BankApp
BankAccount(balance = 1100.00)
BankAccount(balance = 21000.00)
Savings Account(balance = 612.50, rate = 2.500)

}

   


previous | start | next