private static void DoWithdraw(Bank fromBank) { Account toBank = FindAccount(fromBank); if (toBank == null) { return; } String input; decimal withdraw = 0; Console.WriteLine("How much would you like to withdraw?: "); input = Console.ReadLine(); withdraw = Convert.ToDecimal(input); try { input = Console.ReadLine(); withdraw = Convert.ToDecimal(input); } catch (System.FormatException) { Console.WriteLine("Not a number"); } WithdrawTransaction withdrawT = new WithdrawTransaction(toBank, withdraw); fromBank.ExecuteTransaction(withdrawT); withdrawT.Print(); }
private static void DoWithdraw(Bank toBank) { Decimal WithdrawAmount; Account toAccount = FindAccount(toBank); if (toAccount == null) { return; } try { Console.WriteLine("How much would you like to Withdraw? "); WithdrawAmount = Convert.ToDecimal(Console.ReadLine()); } catch { WithdrawAmount = 0; } WithdrawTransaction withdrawtransac = new WithdrawTransaction(toAccount, WithdrawAmount); toBank.ExecuteTransaction(withdrawtransac); withdrawtransac.Print(); }
public static void ExecuteTransaction(WithdrawTransaction transaction) { transaction.Execute(); transaction.Print(); }