1  // A simple application to show how to use the AccountCmp class
  2  //       Nancy McCracken 9/14/97
  3  //
  4  //     AccountTest1  ----uses---->   Account
  5  //					|  subclass
  6  //   AccountCmpTest1 ----uses---->  AccountCmp
  7  //
  8  
  9  
 10  public class AccountCmpTest1 
 11  { 
 12    static AccountCmp paul;    // variable for instance of Account class
 13  
 14    public static void main(String[] args)
 15    {
 16      double interest;
 17  
 18      // create a new instance of the AccountCmp class
 19      paul = new AccountCmp ("Paul", 5000. );
 20    
 21  
 22      System.out.println("Paul's Bank Account         Balance");
 23      System.out.println("Initial balance is            $" 
 24                   + paul.getbalance());
 25  
 26      // call an Account method on the instance paul
 27      paul.deposit(1500.);
 28      System.out.println("Deposits $1500.               $"
 29                   + paul.getbalance());
 30  
 31  
 32      paul.withdraw(523.);
 33      System.out.println("Attempt to withdraw $523.     $"
 34                   + paul.getbalance());
 35  
 36      interest = paul.monthactivity();
 37      System.out.println("After one month, interest $"
 38  	       + interest);
 39      System.out.println("End of the month              $"
 40                   + paul.getbalance());
 41    }
 42  }