static void Main()
 {
     InterestCalculator compoundInterestCalculator = new InterestCalculator(500, 5.6, 10, GetCompoundInterest);
     Console.WriteLine("{0:F4}", compoundInterestCalculator.Balance);
     InterestCalculator simplInterestCalculator = new InterestCalculator(2500, 7.2, 15, GetSimpleInterest);
     Console.WriteLine("{0:F4}", simplInterestCalculator.Balance);
 }
Ejemplo n.º 2
0
        public static void Main()
        {
            InterestCalculator intCalcCompound = new InterestCalculator(2500m, 7.2, 15, GetSimpleInterest);
            Console.WriteLine("{0:0.0000}", intCalcCompound.PaybackValue);

            InterestCalculator intCalcSimple = new InterestCalculator(500m, 5.6, 10, GetCompoundInterest);
            Console.WriteLine("{0:0.0000}", intCalcSimple.PaybackValue);
        }
Ejemplo n.º 3
0
        public static void Main()
        {
            InterestCalculator compound = new InterestCalculator(500, 5.6m, 10, InterestCalculator.GetCompooundInterest);
            Console.WriteLine(compound);

            InterestCalculator simple = new InterestCalculator(2500, 7.2m, 15, InterestCalculator.GetSimpleInterest);
            Console.WriteLine(simple);
        }
Ejemplo n.º 4
0
        static void Main()
        {
            var simpleInterest   = new InterestCalculator(500m, 5.6m, 10, GetCompoundInterest);
            var compoundInterest = new InterestCalculator(2500m, 7.2m, 15, GetSimpleInterest);

            Console.WriteLine(simpleInterest);
            Console.WriteLine(compoundInterest);
        }
Ejemplo n.º 5
0
        static void Main()
        {
            var compound = new InterestCalculator(500, 5.6m, 10, GetCompoundInterest);
            Console.WriteLine(compound);

            var simple = new InterestCalculator(2500, 7.2m, 15, GetSimpleInterest);
            Console.WriteLine(simple);
        }
Ejemplo n.º 6
0
 public static void Main()
 {
     
     InterestCalculator simple = new InterestCalculator(2500m, 7.2,15,GetSimpleInterest);
     Console.WriteLine("{0:0.0000}",simple.result);
     InterestCalculator compound = new InterestCalculator(500m,5.6,10,GetCompoundInterest);
     Console.WriteLine("{0:0.0000}",compound.result);
 }
        internal static void Main()
        {
            InterestCalculator interestOne = new InterestCalculator(500, 5.6, 10, GetCompoundInterest);
            Console.WriteLine(interestOne);

            InterestCalculator interestTwo = new InterestCalculator(2500, 7.2, 15, GetSimpleInterest);
            Console.WriteLine(interestTwo);
        }
        public static void Main()
        {
            InterestCalculator simpleInterest = new InterestCalculator(2.5m, 1.8m, 6, GetSimpleInterest);
            Console.WriteLine(simpleInterest);

            InterestCalculator compoundInterest = new InterestCalculator(2.5m, 1.8m, 6, GetCompoundInterest);
            Console.WriteLine(compoundInterest);
        }
Ejemplo n.º 9
0
        public static void Main()
        {
            InterestCalculator simple = new InterestCalculator(2500m, 7.2, 15, GetSimpleInterest);

            Console.WriteLine("{0:0.0000}", simple.result);
            InterestCalculator compound = new InterestCalculator(500m, 5.6, 10, GetCompoundInterest);

            Console.WriteLine("{0:0.0000}", compound.result);
        }
Ejemplo n.º 10
0
 static void Main(string[] args)
 {
     Func<decimal, decimal, int, decimal> simpleDel = InterestCalculator.GetSimpleInterest;
     Func<decimal, decimal, int, decimal> compoundDel = InterestCalculator.GetCompoundInterest;
     var calc1 = new InterestCalculator(compoundDel, 500m, 5.6m, 10);
     var calc2 = new InterestCalculator(simpleDel, 2500m, 7.2m, 15);
     Console.WriteLine(calc1.ToString());
     Console.WriteLine(calc2.ToString());
 }
Ejemplo n.º 11
0
        public static void Main()
        {
            InterestCalculator intCalcCompound = new InterestCalculator(2500m, 7.2, 15, GetSimpleInterest);

            Console.WriteLine("{0:0.0000}", intCalcCompound.PaybackValue);

            InterestCalculator intCalcSimple = new InterestCalculator(500m, 5.6, 10, GetCompoundInterest);

            Console.WriteLine("{0:0.0000}", intCalcSimple.PaybackValue);
        }
Ejemplo n.º 12
0
        static void Main()
        {
            InterestCalculator compoundCalculator = new InterestCalculator(500, 5.6, 10, GetCompoundInterest);

            Console.WriteLine("{0:0.0000}", compoundCalculator.PaybackValue);

            InterestCalculator simpleCalculator = new InterestCalculator(2500, 7.2, 15, GetSimpleInterest);

            Console.WriteLine("{0:0.0000}", simpleCalculator.PaybackValue);
        }
Ejemplo n.º 13
0
        public static void Main()
        {
            InterestCalculator compoundInterest = new InterestCalculator(500m, 0.056m, 10, GetCompoundInterest);

            Console.WriteLine(compoundInterest.Balance);

            InterestCalculator simpleInterest = new InterestCalculator(2500m, 0.072m, 15, GetSimpleInterest);

            Console.WriteLine(simpleInterest.Balance);
        }
        static void Main(string[] args)
        {
            CalculateInterestDelegate simple = GetSimpleInterestMethod;
            CalculateInterestDelegate compound = GetCompoundInterestMethod;

            var simpleResult = new InterestCalculator(2500m, 7.2m, 15, simple);
            var compoundResult = new InterestCalculator(500m, 5.6m, 10, compound);
            Console.WriteLine(simpleResult);
            Console.WriteLine(compoundResult);
        }
Ejemplo n.º 15
0
    static void Main()
    {
        Func<double, double, int, double> calc = GetSimpleInterest;
        Console.WriteLine(string.Format("{0:F4}", calc(500, 5.6, 10)));

        calc = GetCompoundInterest;
        Console.WriteLine(string.Format("{0:F4}", calc(2500, 7.2, 15)));

        var v = new InterestCalculator.InterestCalculator(500, 5.6, 10, calc);
        Console.WriteLine(v.Calculate());
    }
Ejemplo n.º 16
0
        static void Main()
        {
            PerformCalculation simpleInterestCalc = Interest.GetSimpleInterest;
            PerformCalculation complexInterestCalc = Interest.GetCompoundInterest;

            var simpleInterest = new InterestCalculator(2500, 0.072, 15, simpleInterestCalc);
            var complexInterest = new InterestCalculator(500, 0.056, 10, complexInterestCalc);
            
            Console.WriteLine(simpleInterest);
            Console.WriteLine(complexInterest);
        }
Ejemplo n.º 17
0
        static void Main(string[] args)
        {
            CalculateInterestDelegate simple   = GetSimpleInterestMethod;
            CalculateInterestDelegate compound = GetCompoundInterestMethod;

            var simpleResult   = new InterestCalculator(2500m, 7.2m, 15, simple);
            var compoundResult = new InterestCalculator(500m, 5.6m, 10, compound);

            Console.WriteLine(simpleResult);
            Console.WriteLine(compoundResult);
        }
        static void Main()
        {
            InterestCalculator compoundCalculations = new InterestCalculator(500, 5.6m, 10);
            var simpleCalculations = new InterestCalculator(2500, 7.2m, 15);

            Func <decimal, decimal, int, decimal> compoundCalc = compoundCalculations.GetCompoundInterest;
            Func <decimal, decimal, int, decimal> simpleCalc   = simpleCalculations.GetSimpleInterest;

            Console.WriteLine("{0:0.0000}", compoundCalc(compoundCalculations.Money, compoundCalculations.Interest, compoundCalculations.Years));
            Console.WriteLine("{0:0.0000}", simpleCalc(simpleCalculations.Money, simpleCalculations.Interest, simpleCalculations.Years));
        }
Ejemplo n.º 19
0
        static void Main(string[] args)
        {
            Func <decimal, decimal, int, decimal> simple   = GetSimpleInterest;
            Func <decimal, decimal, int, decimal> compound = GetCompoundInterest;

            var icalc1 = new InterestCalculator(123m, 3.4m, 12, compound);
            var icalc2 = new InterestCalculator(5500m, 8.2m, 13, simple);

            Console.WriteLine(icalc1);
            Console.WriteLine(icalc2);
        }
Ejemplo n.º 20
0
        public static void Main()
        {
            Func <decimal, decimal, int, decimal> simple   = GetSimpleInterest;
            Func <decimal, decimal, int, decimal> compound = GetCompoundInterest;

            var acc1 = new InterestCalculator(500m, 5.6m, 10, compound);
            var acc2 = new InterestCalculator(2500m, 7.2m, 15, simple);

            Console.WriteLine(acc1);
            Console.WriteLine(acc2);
        }
Ejemplo n.º 21
0
        static void Main(string[] args)
        {
            Func<int, double, int, double> simpleInterestDelegate = new Func<int, double, int, double>(GetSimpleInterest);
            Func<int, double, int, double> compoundInterestDelegate = new Func<int, double, int, double>(GetCompoundInterest);

            var calculator = new InterestCalculator(500, 5.6, 10, compoundInterestDelegate);
            Console.WriteLine("{0:0.0000}", calculator.Calculate());

            calculator = new InterestCalculator(2500, 7.2, 15, simpleInterestDelegate);
            Console.WriteLine("{0:0.0000}", calculator.Calculate());
        }
Ejemplo n.º 22
0
        static void Main(string[] args)
        {
            Func <double, double, int, double> simple   = GetSimpleInterest;
            Func <double, double, int, double> compound = GetCompoundInterest;

            var icalc1 = new InterestCalculator(500, 5.6, 10, compound);
            var icalc2 = new InterestCalculator(2500, 7.2, 15, simple);

            Console.WriteLine(icalc1);
            Console.WriteLine(icalc2);
        }
        public static void Main()
        {
            InterestCalculator compountInterest = new InterestCalculator
                                                      (500, 5.6m, 10, InterestCalculator.GetCompoundInterest);

            Console.WriteLine("{0:F4}", compountInterest.CalcualtedInterest);

            InterestCalculator simpleInterest = new InterestCalculator(2500, 7.2m, 15, GetSimpleInterest);

            Console.WriteLine("{0:F4}", simpleInterest.CalcualtedInterest);
        }
        public static void Main()
        {
            Func<decimal, decimal, int, decimal> simple = GetSimpleInterest;
            Func<decimal, decimal, int, decimal> compound = GetCompoundInterest;

            var acc1 = new InterestCalculator(500m, 5.6m, 10, compound);
            var acc2 = new InterestCalculator(2500m, 7.2m, 15, simple);

            Console.WriteLine(acc1);
            Console.WriteLine(acc2);
        }
        static void Main(string[] args)
        {
            Func<double, double, int, double> simple = GetSimpleInterest;
            Func<double, double, int, double> compound = GetCompoundInterest;

            var icalc1 = new InterestCalculator(500, 5.6, 10, compound);
            var icalc2 = new InterestCalculator(2500, 7.2, 15, simple);

            Console.WriteLine(icalc1);
            Console.WriteLine(icalc2);
        }
Ejemplo n.º 26
0
        static void Main(string[] args)
        {
            CalculateInterest simpleInterestMethod   = InterestCalculationMethods.GetSimpleInterest;
            CalculateInterest compoundInterestMethod = InterestCalculationMethods.GetCompoundInterest;

            var simpleInterest   = new InterestCalculator(500m, 5.6m, 10, compoundInterestMethod);
            var compoundInterest = new InterestCalculator(2500m, 7.2m, 15, simpleInterestMethod);

            simpleInterest.PrintInterest();
            compoundInterest.PrintInterest();
        }
Ejemplo n.º 27
0
        static void Main(string[] args)
        {
            InterestCalculator simple = new InterestCalculator(2500m, 7.2, 15, "simple");

            Console.WriteLine(simple);
            InterestCalculator compound = new InterestCalculator(500m, 5.6, 10, "compound");

            Console.WriteLine(compound);
            InterestCalculator test = new InterestCalculator(500m, 5.6, 10, "test");

            Console.WriteLine(test);
        }
Ejemplo n.º 28
0
        static void Main()
        {
            CalculateInterest  d1             = new CalculateInterest(InterestCalculator.GetSimpleInterest);
            InterestCalculator simpleInterest = new InterestCalculator(2500m, 0.072m, 15, d1);

            Console.WriteLine(simpleInterest);

            CalculateInterest  d2 = new CalculateInterest(InterestCalculator.GetCompoundInterest);
            InterestCalculator compoundInterest = new InterestCalculator(500m, 0.056m, 10, d2);

            Console.WriteLine(compoundInterest);
        }
        static void Main(string[] args) //shortcut for static void Main(string[] args) : svm + tab + tab
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

            InterestCalculator interestCalc1 = new InterestCalculator(500m, 5.6m, 10, GetCompoundInterest);

            Console.WriteLine("{0:F4}", interestCalc1.Result);

            InterestCalculator interestCalc2 = new InterestCalculator(2500m, 7.2m, 15, GetSimpleInterest);

            Console.WriteLine("{0:F4}", interestCalc2.Result);
        }
Ejemplo n.º 30
0
        static void Main(string[] args)
        {
            Func <int, double, int, double> simpleInterestDelegate   = new Func <int, double, int, double>(GetSimpleInterest);
            Func <int, double, int, double> compoundInterestDelegate = new Func <int, double, int, double>(GetCompoundInterest);

            var calculator = new InterestCalculator(500, 5.6, 10, compoundInterestDelegate);

            Console.WriteLine("{0:0.0000}", calculator.Calculate());

            calculator = new InterestCalculator(2500, 7.2, 15, simpleInterestDelegate);
            Console.WriteLine("{0:0.0000}", calculator.Calculate());
        }
Ejemplo n.º 31
0
        static void Main()
        {
            InterestCalculator CompundCalc = new InterestCalculator(500, 5.6, 10, GetCompoundInterest);

            Console.WriteLine(CompundCalc);

            InterestCalculator SimpleCalc = new InterestCalculator(2500, 7.2, 15, GetSimpleInterest);

            Console.WriteLine(SimpleCalc);

            Console.ReadKey();
        }
Ejemplo n.º 32
0
 static void Main()
 {
     CalculateInterest del = new CalculateInterest(GetCompoundInterest);
     InterestCalculator interest = new InterestCalculator(500, 5.6m, 10, del);
     Console.WriteLine("Money: {0}, Interest: {1}%, Years: {2},  Type: compound, Result: {3}",
         interest.Money, interest.Interest, interest.Years, interest.Del(interest.Money, interest.Interest, interest.Years));
     del -= GetCompoundInterest;
     del += GetSimpleInterest;
     InterestCalculator simpleInterest = new InterestCalculator(2500, 7.2m, 15, del);
     Console.WriteLine("Money: {0}, Interest: {1}%, Years: {2},  Type: simple, Result: {3}",
         simpleInterest.Money, simpleInterest.Interest, simpleInterest.Years,
         simpleInterest.Del(simpleInterest.Money, simpleInterest.Interest, simpleInterest.Years));
 }
Ejemplo n.º 33
0
        static void Main()
        {
            //InterestCalculation overallSimpleInterest = (sumMoney, interest, years)
            //    =>
            //        {
            //            return Math.Round(sumMoney *(1 + years * interest / 100), 4);
            //        };

            InterestCalculation overallSimpleInterest = GetSimpleInterest;
            var simpleInterest = new InterestCalculator(2500, 7.2m, 15, overallSimpleInterest);
            Console.WriteLine("Simple interest sum: " + simpleInterest.CalcInterest());

            InterestCalculation overallCompoundInterest = GetCompoundInterest;
            var compoundInterest = new InterestCalculator(500, 5.6m, 10, overallCompoundInterest);
            Console.WriteLine("Compound interest sum: " + compoundInterest.CalcInterest());
        }
Ejemplo n.º 34
0
        static void Main()
        {
            //InterestCalculation overallSimpleInterest = (sumMoney, interest, years)
            //    =>
            //        {
            //            return Math.Round(sumMoney *(1 + years * interest / 100), 4);
            //        };

            InterestCalculation overallSimpleInterest = GetSimpleInterest;
            var simpleInterest = new InterestCalculator(2500, 7.2m, 15, overallSimpleInterest);

            Console.WriteLine("Simple interest sum: " + simpleInterest.CalcInterest());

            InterestCalculation overallCompoundInterest = GetCompoundInterest;
            var compoundInterest = new InterestCalculator(500, 5.6m, 10, overallCompoundInterest);

            Console.WriteLine("Compound interest sum: " + compoundInterest.CalcInterest());
        }
Ejemplo n.º 35
0
        static void Main(string[] args)
        {
            //Using class instance
            InterestCalculator simple = new InterestCalculator(500, 5.6m, 10, GetCompoundInterest);
            Console.WriteLine(simple);
            InterestCalculator compound = new InterestCalculator(2500, 7.2m, 15, GetSimpleInterest);
            Console.WriteLine(compound);

            //Func delegate
            Func<decimal, decimal, int, decimal> firstDelegate = (GetCompoundInterest);
            Console.WriteLine("{0:f4}", firstDelegate(500, 5.6m, 10));
            Func<decimal, decimal, int, decimal> secondDelegate = (GetSimpleInterest);
            Console.WriteLine("{0:f4}", secondDelegate(2500, 7.2m, 15));

            //Action delegate
            Action<decimal, decimal, int> actionDelegateOne = (money, interestRate, years) => Console.WriteLine("{0:f4}",GetCompoundInterest(money,interestRate, years));
            actionDelegateOne(500, 5.6m, 10);
            Action<decimal, decimal, int> actionDelegateTwo = (money, interestRate, years) => Console.WriteLine("{0:f4}", GetSimpleInterest(money, interestRate, years));
            actionDelegateTwo(2500, 7.2m, 15);
        }
Ejemplo n.º 36
0
        public static void Main(string[] args)
        {
            InterestCalculator interest = new InterestCalculator(500m, 5.6m, 10, GetSimpleInterest);

            Console.WriteLine(interest);
        }
Ejemplo n.º 37
0
 public static void Main(string[] args)
 {
     InterestCalculator interest = new InterestCalculator(500m, 5.6m, 10, GetSimpleInterest);
     Console.WriteLine(interest);
 }