Ejemplo n.º 1
0
 public void Transfer(BankAccount reciverAccount, AccountType type, decimal amount, DateTime date, string note)
 {
     if (reciverAccount.Number == this.Number)
     {
         throw new AccessViolationException("You cannot transfer to yourself");
     }
     reciverAccount.MakeDeposit(amount, date, note);
     this.MakeWithdrawal(amount, type, date, note);
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var account = new BankAccount("<name>", 1000);

            Console.WriteLine($"Account {account.Number} was created for {account.Owner} with {account.Balance} balance.");

            account.MakeWithdrawal(500, DateTime.Now, "Rent payment");
            account.MakeDeposit(100, DateTime.Now, "friend paid me back");

            Console.WriteLine(account.GetAccountHistory());
        }