public void CalcularInvestimento(InvestimentoBancario investimentoBank, IInvestimento investimento) { var resultInvestimento = investimento.Investir(investimentoBank); var conta = new ContaBancaria(); conta.Depositar(resultInvestimento * 0.75); Console.WriteLine(resultInvestimento); }
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); }
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(); }
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); }
public double Investir(InvestimentoBancario investimento) => investimento.Valor * 0.8;