//Copyright (c) 2002, Art Gittleman //This example is provided WITHOUT ANY WARRANTY //either expressed or implied. /* Tests the TestAccounts class. */ using System; public class TestAccounts { public static void Main() { /* SavingsAccount s = new SavingsAccount(500.00, 4.5); s.Deposit(135.22); s.PostInterest(); s.Withdraw(50); Console.WriteLine ("The balance of SavingsAccount s is {0:C}", s.GetBalance()); */ //Testing code for Exercise 10.9 BankAccount b0 = new BankAccount(); SavingsAccount s0 = new SavingsAccount(100,3); CheckingAccount c0 = new CheckingAccount(50, 30); BankAccount b1 = b0.ReadAccount(); SavingsAccount s1 = (SavingsAccount)s0.ReadAccount(); CheckingAccount c1 = (CheckingAccount)c0.ReadAccount(); Console.WriteLine("Initial information of three read-in accounts: "); Console.WriteLine("Bank account: "+b1); Console.WriteLine("Savings account: "+s1); Console.WriteLine("Checking account: "+c1); Console.WriteLine("\n\n"); b1.Deposit(158.0); b1.Withdraw(52.0); s1.Deposit(3000.0); s1.PostInterest(); s1.Withdraw(40.0); c1.Deposit(450.0); c1.Withdraw(500.0); Console.WriteLine("\n\n"); Console.WriteLine("Current information of three read-in accounts: "); Console.WriteLine("Bank account: "+b1); Console.WriteLine("Savings account: "+s1); Console.WriteLine("Checking account: "+c1); } }