public static double Withdraw(AccountData account, double amount) { var delta = amount; if (account.Amount >= amount) { account.Amount -= amount; } else { Console.WriteLine("Could not withdraw that much!"); delta = 0; } AccountLog.Log(account, $"Withdrew {delta}"); return(delta); }
internal static void Transfer(AccountData withdrawee, AccountData depositee, double amount) { AccountLog.Log(withdrawee, $"attempted to transfer out {amount}"); AccountLog.Log(depositee, $"preparing to accept in {amount}"); Deposit(depositee, Withdraw(withdrawee, amount)); }
public static void Deposit(AccountData account, double amount) { account.Amount += amount; AccountLog.Log(account, $"deposited {amount}"); }