//Copyright (c) 2002, Art Gittleman //This example is provided WITHOUT ANY WARRANTY //either expressed or implied. /* Creates and tests some BankAccount objects. */ using System; public class TestBankAccount { public static void Main () { BankAccount myAccount = new BankAccount(25.00); Console.WriteLine ("My balance = {0:C}", myAccount.GetBalance()); myAccount.Deposit(700.00); Console.WriteLine ("My balance = {0:C}", myAccount.GetBalance()); if(myAccount.Withdraw(300.00) < 0) Console.WriteLine("Insufficient funds"); Console.WriteLine ("My balance = {0:C}", myAccount.GetBalance()); if(myAccount.Withdraw(450.00) < 0) Console.WriteLine("Insufficient funds"); Console.WriteLine ("My balance = {0:C}", myAccount.GetBalance()); BankAccount yourAccount = new BankAccount(); yourAccount.Deposit(1234.56); Console.WriteLine ("Your balance = {0:C}", yourAccount.GetBalance()); } }