static void Main() { IBankAccount venusAccount = new SaverAccount(); IBankAccount jupiterAccount = new GoldAccount(); venusAccount.PayIn(200); venusAccount.Withdraw(100); Console.WriteLine(venusAccount.ToString()); jupiterAccount.PayIn(500); jupiterAccount.Withdraw(600); jupiterAccount.Withdraw(100); Console.WriteLine(jupiterAccount.ToString()); }
static void Main() { IBankAccount venusAccount = new SaverAccount(); IBankAccount jupiterAccount = new GoldAccount(); venusAccount.PayIn(200); venusAccount.Withdraw(100); Console.WriteLine(venusAccount.ToString()); jupiterAccount.PayIn(500); jupiterAccount.Withdraw(600); jupiterAccount.Withdraw(100); Console.WriteLine(jupiterAccount.ToString()); }
private void button1_Click(object sender, EventArgs e) { IBankAccount venusAccount = new SaverAccount(); IBankAccount jupiterAccount = new GoldAccount(); venusAccount.PayIn(200); venusAccount.Withdraw(100); Console.WriteLine(venusAccount.ToString()); jupiterAccount.PayIn(500); jupiterAccount.Withdraw(600); jupiterAccount.Withdraw(100); Console.WriteLine(jupiterAccount.ToString()); }
static void Main(string[] args) { IBankAccount saver = new SaverAccount(); IBankAccount gold = new GoldAccount(); try { Console.WriteLine("First count:"); Console.WriteLine($"Number of Gold Accounts: {GoldAccount.NumOfAccounts}"); Console.WriteLine($"Number of Saver Accounts: {SaverAccount.NumOfAccounts}"); IBankAccount saver1 = new SaverAccount(); IBankAccount gold1 = new GoldAccount(); Console.WriteLine("Second count:"); Console.WriteLine($"Number of Gold Accounts: {GoldAccount.NumOfAccounts}"); Console.WriteLine($"Number of Saver Accounts: {SaverAccount.NumOfAccounts}"); gold1 = null; saver1 = null; GC.Collect(); Console.WriteLine("After null:"); Console.WriteLine($"Number of Gold Accounts: {GoldAccount.NumOfAccounts}"); Console.WriteLine($"Number of Saver Accounts: {SaverAccount.NumOfAccounts}"); saver.Deposit(1250.75M); saver.Withdraw(700.50M); gold.Deposit(5000.38M); gold.Withdraw(5678.90M); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { Console.WriteLine($"after withdrawal of $700.50...{saver.ToString()}"); Console.WriteLine($"after (failed)withdrawal of $5678.90...{gold.ToString()}"); } }
public static void Main() { IBankAccount venusAccount = new SaverAccount(); IBankAccount jupiterAccount = new GoldAccount(); venusAccount.PayIn(200); venusAccount.Withdraw(100); Console.WriteLine(venusAccount.ToString()); jupiterAccount.PayIn(500); jupiterAccount.Withdraw(600); jupiterAccount.Withdraw(100); Console.WriteLine(jupiterAccount.ToString()); ITransferBankAccount jupiterAccount2 = new CurrentAccount(); jupiterAccount2.PayIn(500); jupiterAccount2.TransferTo(venusAccount, 100); Console.WriteLine(venusAccount.ToString()); Console.WriteLine(jupiterAccount2.ToString()); }
static void Main(string[] args) { IBankAccount saver = new SaverAccount(); IBankAccount gold = new GoldAccount(); try { saver.Deposit(1250.75M); saver.Withdraw(700.50M); gold.Deposit(5000.38M); gold.Withdraw(5678.90M); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { Console.WriteLine($"after withdrawal of $700.50...{saver.ToString()}"); Console.WriteLine($"after (failed)withdrawal of $5678.90...{gold.ToString()}"); } }