static void Main(string[] args)
        {
            CarCompanyFinancialCalculator  carCompanyFinancialCalculator   = new CarCompanyFinancialCalculator();
            TreeCompanyFinancialCalculator treerCompanyFinancialCalculator = new TreeCompanyFinancialCalculator();

            decimal annualResult = CarCompanyFinancialCalculator.CalculateAnnualFinances(20000m);
        }
예제 #2
0
        static void Main(string[] args)
        {
            CarCompanyFinancialCalculator  carCompanyFinancialCalculator  = new CarCompanyFinancialCalculator();
            TreeCompanyFinancialCalculator treeCompanyFinancialCalculator = new TreeCompanyFinancialCalculator();

            List <IFinancialCalculator> financialCalculators = new List <IFinancialCalculator>();

            financialCalculators.Add(carCompanyFinancialCalculator);
            financialCalculators.Add(treeCompanyFinancialCalculator);

            //Przykłady pętli

            foreach (var item in financialCalculators)
            {
                CalculateFinance(item, 20000, 1500, 50);
            }

            //for (int i = 0; i < financialCalculators.Count; i++)
            //{
            //    CalculateFinance(financialCalculators[i], 20000, 1500, 50);
            //}

            //int j = 0;
            //while (j < financialCalculators.Count)
            //{
            //    CalculateFinance(financialCalculators[j], 20000, 1500, 50);
            //    j++;
            //}

            //int k = 0;
            //do
            //{
            //    CalculateFinance(financialCalculators[i], 20000, 1500, 50);
            //    k++;
            //} while (k < financialCalculators.Count);

            //CalculateFinance(carCompanyFinancialCalculator, 20000, 1500, 50);
            //decimal vatResult = carCompanyFinancialCalculator.CalculateVat(25000);

            //CalculateFinance(treeCompanyFinancialCalculator, 20000, 1500, 50);
            //vatResult = treeCompanyFinancialCalculator.CalculateVat(25000);
        }