Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 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));
 }
Esempio n. 3
0
 public static void Deposit(AccountData account, double amount)
 {
     account.Amount += amount;
     AccountLog.Log(account, $"deposited {amount}");
 }