コード例 #1
0
        public void CalculateSellingPrice(IAsset asset, ICommissionCalculator commissionCalculator)
        {
            decimal commission = commissionCalculator.CalculateCommission(asset.Price, asset.CommissionRate);

            decimal sellingPrice = asset.Price + commission;

            if (typeof(UrbanPlot).IsInstanceOfType(asset))
            {
                Console.WriteLine("\nThe selling price for the Asset with the Cadastral Reference '" + asset.GetAssetAttribute() +
                                  "' is " + sellingPrice + " RON. \n" + "The applied commission is " + commission + " RON.");
            }
            else
            {
                Console.WriteLine("\nThe selling price for the Asset with the address '" + asset.GetAssetAttribute() +
                                  "' is " + sellingPrice + " RON. \n" + "The applied commission is " + commission + " RON.");
            }
        }
コード例 #2
0
            public static void GetCommissionFrom(RealEstateAgency rea, decimal price, ICommissionCalculator commissionCalculator)
            {
                var commissionValue = commissionCalculator.CalculateCommission(rea, price);

                Console.WriteLine("The commission for " + rea.GetType().Name + " is " + commissionValue + "€");
            }