Пример #1
0
 public void Transfer(BankAccount8 a, double amount) //Transfer
 {
     Console.WriteLine($"Your balance before transfer is {balance:C}.");
     balance   = balance - amount;
     a.balance = a.balance - amount;
     Console.WriteLine($"{amount:C} transferred to {a.GetName()}. Your current balance is {this.GetBalance():C}");
 }
Пример #2
0
        static void Main()
        {
            BankAccount8 ac = new BankAccount8("ABC", 1111, 500);

            Console.WriteLine(ac.GetName());
            Console.WriteLine(ac.GetBalance());
            Console.WriteLine(ac.GetState());

            Console.WriteLine("Balance is 500, trying to withdraw 450");
            ac.Withdraw(450);
            Console.WriteLine(ac.GetBalance());
            Console.WriteLine(ac.GetState());

            Console.WriteLine("Balance is 50, trying to withdraw 20 under min balance amount");
            ac.Withdraw(20);
            Console.WriteLine(ac.GetBalance());
            Console.WriteLine(ac.GetState());
        }