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);
 }
示例#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);
        }
示例#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);
        }
示例#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);
        }
        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);
        }
示例#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);
        }
示例#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);
        }
示例#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());
 }
示例#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);
        }
        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);
        }
示例#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);
        }
示例#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());
    }
示例#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);
        }
示例#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));
        }
示例#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);
        }
示例#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);
        }
示例#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());
        }
示例#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);
        }
示例#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();
        }
示例#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);
        }
示例#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);
        }
示例#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());
        }
示例#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();
        }
示例#32
0
文件: MainProgram.cs 项目: T316/OOP
 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));
 }
示例#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());
        }
示例#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());
        }
示例#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);
        }
示例#36
0
        public static void Main(string[] args)
        {
            InterestCalculator interest = new InterestCalculator(500m, 5.6m, 10, GetSimpleInterest);

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