Example #1
0
        static void Main(string[] args)
        {
            ListaDeContaCorrentes lista = new ListaDeContaCorrentes();

            ContaCorrente ContadoGui = new ContaCorrente(123, 00999);

            lista.Adicionar(ContadoGui);

            /*
             * lista.Adicionar(new ContaCorrente(345, 23462));
             * lista.Adicionar(new ContaCorrente(363, 22451));
             * lista.Adicionar(new ContaCorrente(735, 23552));
             * lista.Adicionar(new ContaCorrente(735, 23552));
             * lista.Adicionar(new ContaCorrente(735, 23552));
             * lista.Adicionar(new ContaCorrente(735, 23552));
             * lista.Adicionar(new ContaCorrente(735, 23552));
             * lista.Adicionar(new ContaCorrente(735, 23552));
             * lista.Adicionar(new ContaCorrente(735, 23552));
             * lista.Adicionar(new ContaCorrente(735, 23552));
             * lista.Adicionar(new ContaCorrente(735, 23552));
             * lista.Adicionar(new ContaCorrente(735, 23552));
             * lista.Adicionar(new ContaCorrente(735, 23552));
             * lista.Adicionar(new ContaCorrente(735, 23552));
             * lista.Adicionar(new ContaCorrente(735, 23552));
             * lista.Adicionar(new ContaCorrente(735, 23552));
             * lista.Adicionar(new ContaCorrente(735, 23552));
             * lista.Adicionar(new ContaCorrente(735, 23552));
             * lista.Adicionar(new ContaCorrente(735, 23552));
             * lista.Adicionar(new ContaCorrente(735, 23552));
             */
            // lista.EscreverListaNaTela();

            // lista.remover(ContadoGui);

            // Console.WriteLine("após remover o item...");
            // lista.EscreverListaNaTela();

            /*
             * int[] numeros = { 1, 2, 3, 4 };
             *
             * ListaDeContaCorrentes.SomarNumeros(numeros);
             */

            //método GetItemNoIndice visa mostrar o elemento no array dentro da estrutura
            // de repetição for a  partir do encapsulamento do atributo Tamanho em listaDeContaCorrentes


            for (int i = 0; i < lista.Tamanho; i++)
            {
                ContaCorrente teste     = lista["texto"]; // acessar um item por meio de qualquer tipo de indice (indexador)
                ContaCorrente itemAtual = lista.GetItemNoIndice(i);
                Console.WriteLine($"Item na posição {i}= Conta {itemAtual.Numero}/{itemAtual.Agencia} ");
            }

            //utilizando o params
            lista.AdicionarVarios(ContadoGui, new ContaCorrente(735, 23552));


            Console.ReadKey();
        }
Example #2
0
        static void TestaParametrosDinamicosParams()
        {
            ContaCorrente         contaVaz = new ContaCorrente(222, 10000000);
            ListaDeContaCorrentes lista    = new ListaDeContaCorrentes();

            lista.Adicionar(contaVaz);

            contaVaz.Depositar(1500);

            ContaCorrente[] contas = new ContaCorrente[]
            {
                new ContaCorrente(111, 87103824),
                new ContaCorrente(111, 65498132),
                new ContaCorrente(111, 32482843),
                new ContaCorrente(111, 15646645),
                new ContaCorrente(111, 78616846),
                new ContaCorrente(111, 16885385)
            };

            lista.AdicionarVarios(contas);

            contaVaz.Transferir(350.71, lista[5]);
            for (int i = 0; i < lista.Tamanho; i++)
            {
                ContaCorrente itemAtual = lista[i];
                Console.WriteLine($"Item na posição {i}: {itemAtual}");
            }
        }