Пример #1
0
        static void Main(string[] args)
        {
            BankAccount    ba;
            SavingsAccount sa;

            ba = new BankAccount(200M);
            ba.Withdraw(100M);

            sa = new SavingsAccount(222M, 12);
            sa.Withdraw(100M);

            Console.WriteLine("When invode directly:");
            Console.WriteLine("BankAccount balance is {0}", ba.Balance);
            Console.WriteLine("SavingsAccount balance is {0}", sa.Balance);

            Console.WriteLine("");
        }
Пример #2
0
 public static void Main(string[] args)
 {
     BankAccount ba;
     SavingsAccount sa;
     // Create a bank account, withdraw $100, and
     // display the results.
     ba = new BankAccount(200M);
     ba.Withdraw(100M);
     // Try the same trick with a savings account.
     sa = new SavingsAccount(200M, 12);
     sa.Withdraw(100M);
     // Display the resulting balance.
     Console.WriteLine("When invoked directly:");
     Console.WriteLine("BankAccount balance is {0:C}", ba.Balance);
     Console.WriteLine("SavingsAccount balance is {0:C}", sa.Balance);
     // Wait for user to acknowledge the results.
     Console.WriteLine("Press Enter to terminate...");
     Console.Read();
 }
Пример #3
0
        static void Main(string[] args)
        {
            BankAccount    ba;
            SavingsAccount sa;

            // Create a bank account, withdraw $100, and
            // display the results.
            ba = new BankAccount(200M);
            ba.Withdraw(100M);

            // Try the same trick with a savings account.
            sa = new SavingsAccount(200M, 12);
            sa.Withdraw(100M);
            // Display the resulting balance.
            Console.WriteLine("When invoked directly:");
            Console.WriteLine("BankAccount balance is {0:C}", ba.Balance);
            Console.WriteLine("SavingsAccount balance is {0:C}", sa.Balance);

            // Wait for user to acknowledge the results.
            Console.WriteLine("Press Enter to terminate...");
            Console.Read();
        }
Пример #4
0
 public static void MakeAWithdrawal(BankAccount ba,
                                    decimal mAmount)
 {
     ba.Withdraw(mAmount);
 }
Пример #5
0
 public static void MakeAWithdrawal(BankAccount ba, decimal amount)
 {
     ba.Withdraw(amount);
 }