1  // A simple application to show how to use the Account class
  2  //       Nancy McCracken 10/7/98
  3  //
  4  //   AccountTest2 ----uses---->   Account
  5  //
  6  
  7  public class AccountTest2 
  8  { // variables for instances of Account class
  9    static Account george;   
 10    static Account ringo;
 11  
 12    public static void main (String[] args)
 13    {
 14      double interest;
 15  
 16      // create new instances of the Account class
 17      george = new Account ("George", 5000. );
 18      ringo = new Account ("Ringo", 10000. );
 19      
 20      System.out.println("George's Bank Account       Balance"
 21                      + "    Ringo's Bank Account        Balance");
 22  
 23      // call an Account method on the the two instances and print
 24      System.out.println("Initial balance is          $" 
 25                   + george.getbalance()
 26                   + "    Initial balance is         $"
 27                   + ringo.getbalance());
 28  
 29      // more Account methods
 30      george.deposit(1500.);
 31      System.out.println("Deposits $1500.             $"
 32                   + george.getbalance());
 33      ringo.deposit(823.);
 34      System.out.println("                                       "
 35                   +  "Deposits $823.             $"
 36                   + ringo.getbalance());
 37  
 38  
 39      george.withdraw(523.);
 40      System.out.println("Attempt to withdraw $523.   $"
 41                   + george.getbalance());
 42  
 43      interest = george.monthactivity();
 44      System.out.println("After one month, interest $"
 45  	       + interest);
 46      interest = ringo.monthactivity();
 47      System.out.println("                                  "
 48                 + "After one month, interest $"
 49  	       + interest);
 50  
 51      System.out.println("End of the month            $"
 52                   + george.getbalancedollars() +"." + george.getbalancecents()
 53                   + "                               $"
 54                   + ringo.getbalancedollars() + "." + ringo.getbalancecents());
 55    }
 56  }