public void CalcularInvestimento(InvestimentoBancario investimentoBank, IInvestimento investimento)
        {
            var resultInvestimento = investimento.Investir(investimentoBank);
            var conta = new ContaBancaria();

            conta.Depositar(resultInvestimento * 0.75);
            Console.WriteLine(resultInvestimento);
        }
Esempio n. 2
0
        public double Investir(InvestimentoBancario investimento)
        {
            double investimentoCalc;

            if (new Random().Next(101) <= 50)
            {
                investimentoCalc = investimento.Valor * 0.025;
            }
            else
            {
                investimentoCalc = investimento.Valor * 0.07;
            }

            return(investimentoCalc);
        }
Esempio n. 3
0
        private static void StrategyInvestimentoTest()
        {
            var investimento = new InvestimentoBancario(10);
            var calculador   = new CalculadorInvestimento();

            Console.WriteLine("Calculando investimento moderado...");
            calculador.CalcularInvestimento(investimento, new Moderado());

            Console.WriteLine("Calculando investimento conservador...");
            calculador.CalcularInvestimento(investimento, new Conservador());

            Console.WriteLine("Calculando investimento arrojado...");
            calculador.CalcularInvestimento(investimento, new Arrojado());

            Console.ReadLine();
        }
Esempio n. 4
0
        public double Investir(InvestimentoBancario investimento)
        {
            double investimentoCalc;
            var    random = new Random();

            if (random.Next(101) <= 20)
            {
                investimentoCalc = investimento.Valor * 0.05;
            }
            else if (random.Next(101) <= 50)
            {
                investimentoCalc = investimento.Valor * 0.03;
            }
            else
            {
                investimentoCalc = investimento.Valor * 0.06;
            }

            return(investimentoCalc);
        }
Esempio n. 5
0
 public double Investir(InvestimentoBancario investimento) => investimento.Valor * 0.8;