Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("DEMO Cuenta");
            var c = new Cuenta("CC#1", 100);
            var o = new Cuenta("CA#2", 0);

            if (true)
            {
                var T = new Transacciones();
                Console.WriteLine($" » {c} | {o}");
                T.Agregar(new DepositarComando(c, 100));
                T.Agregar(new ExtraerComando(c, 50));
                T.Agregar(new TransferirComando(c, o, 30));
                Console.WriteLine($" » {c} | {o}");
                T.EjecutarTodo();
                Console.WriteLine($" » {c} | {o}");
                T.Deshacer();
                Console.WriteLine($" » {c} | {o}");
            }
            else
            {
                Console.WriteLine($" » {c} | {o}");
                c.Depositar(100);
                Console.WriteLine($" » {c} | {o}");
                c.Extraer(50);
                Console.WriteLine($" » {c} | {o}");
                c.Transferir(o, 30);
                Console.WriteLine($" » {c} | {o}");
            }
            Console.ReadLine();
        }
Esempio n. 2
0
 public void Transferir(Cuenta destino, double monto)
 {
     this.Extraer(monto);
     destino.Depositar(monto);
 }