コード例 #1
0
ファイル: Account.cs プロジェクト: gladstonedigital/bank
        public bool transfer(Account from, Currency amount)
        {
            if (!String.Equals(balance.symbol, from.balance.symbol) || !String.Equals(balance.symbol, amount.symbol))
            {
                Console.WriteLine("Transfer currencies do not match");
                return(false);
            }

            if (from.accountNumber == accountNumber)
            {
                Console.WriteLine("Can't transfer between same account");
                return(false);
            }

            return(from.withdraw(amount) && deposit(amount));
        }