public void Sell(string id, double volume, double pricePerUnit) { IInvestment investment = investmentsById[id]; liquidity += volume * pricePerUnit; investment.Quantity -= volume; }
public void Calculates(Account account, IInvestment investment) { System.Console.WriteLine($"Saldo atual: {account.Balance}"); double result = investment.Calculates(account); account.Deposit(result * 0.75); System.Console.WriteLine($"Novo saldo: {account.Balance}"); }
public void ShowInvestmentDetails(IInvestment investment) { Console.WriteLine("Investment Type : {0}", InvestmentType); Console.WriteLine("Rarity Benchmark : {0}", RarityBenchmark); Console.WriteLine("Investment Year : {0}", InvestYear); Console.WriteLine("Capital Value : {0:c}", Capital); Console.WriteLine("Current Value : {0:c}", CalculateValue(investment)); }
static void Main(string[] args) { //Investments investment = new Investments(); //investment.addInvestments(new Coin()); IInvestment[] iinvestment = new IInvestment[] { new Coin("2014-02-01", 0, 12, 10), new Gold("2015-02-01", 0, 22, 20), new Antique("2015-02-01", 0, 32, 30) }; foreach (IInvestment invest in iinvestment) { System.Console.WriteLine("The investment is {0}", invest); System.Console.WriteLine("Total value={0}", invest.estimatedValue()); System.Console.WriteLine("profits={0}", invest.profits()); } }
public void Add(IInvestment i) { inv.Add(i); }
public void AddInvestmentType(IInvestment investment) { ValidateInput(investment); _InvestmentStructure.Add(investment); }
public double Calculate(BankAccount bankAccount, IInvestment investmentStrategy) { var profitOfInvestment = investmentStrategy.CalculateProfit(bankAccount); return(profitOfInvestment); }
public double CalculateProfit(IInvestment investment) { return(CalculateValue(investment) - Capital); }
public void AddInvestment(IInvestment investment) { InvestmentList.Add(investment); }
public double CalculateValue(IInvestment investment) { return(CalculateTimeValue(InvestYear, InvestmentType, RarityBenchmark, Capital)); }