Пример #1
0
        public void TransferTo(double x, Account1 b)
        {
            if (balance > x)
            {
                //Deduct from A
                this.balance = balance - x;

                //Add to accnt B
                b.Deposit(x);
            }
            else
            {
                Console.WriteLine("Error. Your balance is less than the transfered amount");
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Account1 a = new Account1("001-001-001", "Tan Ah Kow", 2000);
            Account1 b = new Account1("001-001-002", "Kim Keng Lee", 5000);

            Console.WriteLine(a.Show());
            Console.WriteLine(b.Show());
            a.Deposit(100);
            Console.WriteLine(a.Show());
            a.Withdraw(200);
            Console.WriteLine(a.Show());
            a.TransferTo(300, b);
            Console.WriteLine(a.Show());
            Console.WriteLine(b.Show());
        }