예제 #1
0
        public void Sell(string id, double volume, double pricePerUnit)
        {
            IInvestment investment = investmentsById[id];

            liquidity           += volume * pricePerUnit;
            investment.Quantity -= volume;
        }
예제 #2
0
        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}");
        }
예제 #3
0
 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));
 }
예제 #4
0
 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());
     }
 }
예제 #5
0
 public void Add(IInvestment i)
 {
     inv.Add(i);
 }
예제 #6
0
 public void AddInvestmentType(IInvestment investment)
 {
     ValidateInput(investment);
     _InvestmentStructure.Add(investment);
 }
예제 #7
0
        public double Calculate(BankAccount bankAccount, IInvestment investmentStrategy)
        {
            var profitOfInvestment = investmentStrategy.CalculateProfit(bankAccount);

            return(profitOfInvestment);
        }
예제 #8
0
 public double CalculateProfit(IInvestment investment)
 {
     return(CalculateValue(investment) - Capital);
 }
예제 #9
0
 public void AddInvestment(IInvestment investment)
 {
     InvestmentList.Add(investment);
 }
예제 #10
0
 public double CalculateValue(IInvestment investment)
 {
     return(CalculateTimeValue(InvestYear, InvestmentType, RarityBenchmark, Capital));
 }