home *** CD-ROM | disk | FTP | other *** search
/ Learn Java Now / Learn_Java_Now_Microsoft_1996.iso / JavaNow / Code / Chap04 / BankAccount / App1_4.class (.txt) next >
Encoding:
Java Class File  |  1996-07-29  |  1.4 KB  |  28 lines

  1. public class App1_4 {
  2.    public static void main(String[] args) {
  3.       double dPerMonth = (double)Integer.parseInt(args[0]);
  4.       double dInterest = (double)Integer.parseInt(args[1]);
  5.       BankAccount.Rate(dInterest);
  6.       BankAccount baMyAccount = new BankAccount();
  7.       System.out.println("Depositing " + dPerMonth + " per month at " + BankAccount.Rate() + " per cent interest");
  8.       System.out.println("Watch my account grow!");
  9.       int nYear = 0;
  10.  
  11.       do {
  12.          System.out.print(nYear + " - ");
  13.          int nMonth = 0;
  14.  
  15.          do {
  16.             baMyAccount.Deposit(dPerMonth);
  17.             baMyAccount.Monthly();
  18.             System.out.print(baMyAccount.Balance() + ", ");
  19.             ++nMonth;
  20.          } while(nMonth < 12);
  21.  
  22.          System.out.println();
  23.          ++nYear;
  24.       } while(nYear < 10);
  25.  
  26.    }
  27. }
  28.