Ejemplo n.º 1
0
 void TransferTo(BankAccount3 bankAccountNumber, double amount)
 {
     if (WithDraw(amount))
     {
         bankAccountNumber.Deposit(amount);
     }
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Customer     customer1 = new Customer("samyu", "addr1", "1234566");
            BankAccount3 account1  = new BankAccount3("100001", customer1, 2000);

            account1.Deposit(2000);

            account1.WithDraw(2000);

            System.Console.WriteLine("The account1 customer is " + account1.Show());
            Customer     customer2 = new Customer("adi", "addr2", "1234566");
            BankAccount3 account2  = new BankAccount3("100002", customer2, 3000);

            account2.TransferTo(account1, 3000);
            System.Console.WriteLine("The account2 customer is " + account2.Show());

            account1.CreditInterest(account1.CalculateInterest());
            System.Console.WriteLine("The account1 customer in savings accountis " + account1.Show());

            CurrentAccount currentAccount = new CurrentAccount("100001", customer1, 2000);

            currentAccount.CreditInterest(currentAccount.CalculateInterest(currentAccount.Balance));
            System.Console.WriteLine("The account1 customer is " + currentAccount.Show());

            OverDraft overDraft = new OverDraft("100001", customer1, 2000);

            overDraft.WithDraw(2000);
            overDraft.WithDraw(2000);
            overDraft.WithDraw(2000);
            overDraft.WithDraw(2000);
            overDraft.CreditInterest(overDraft.CalculateInterest());
            System.Console.WriteLine("The account1 customer is " + overDraft.Show());
        }