public class SavingsAccountDemo
1:
2: public class SavingsAccountDemo
3: {
4: public static void main(String[] args)
5: {
6: SavingsAccount.setInterestRate(0.01);
7: SavingsAccount mySavings = new SavingsAccount( );
8: SavingsAccount yourSavings = new SavingsAccount( );
9:
10: System.out.println("I deposited $10.75.");
11: mySavings.deposit(10.75);
12: System.out.println("You deposited $75.");
13: yourSavings.deposit(75.00);
14: System.out.println("You deposited $55.");
15: yourSavings.deposit(55.00);
16:
17: double cash = yourSavings.withdraw(15.75);
18: System.out.println("You withdrew $" + cash + ".");
19: if (yourSavings.getBalance() > 100.00)
20: {
21: System.out.println("You received interest.");
22: yourSavings.addInterest();
23: }
24:
25: System.out.println("Your savings is $" + yourSavings.getBalance());
26: System.out.print("My savings is $");
27: SavingsAccount.showBalance(mySavings);
28: System.out.println();
29: int count = SavingsAccount.getNumberOfAccounts();
30: System.out.println("We opened " + count +
31: " savings accounts today.");
32: }
33: }