示例#1
0
        private static void Main()
        {
            CalculateInterest simple = GetSimpleInterest;
            CalculateInterest compound = GetCompoundInterest;

            var calculator = new InterestCalculator(500, 5.6, 10, compound);
            Console.WriteLine(calculator.Calculate());
            var secondCalculator = new InterestCalculator(2500, 7.2, 15, simple);
            Console.WriteLine(secondCalculator.Calculate());
        }
        static void Main(string[] args)
        {
            Func<decimal, decimal, int, decimal> simple = GetSimpleInterest;
            Func<decimal, decimal, int, decimal> compound = GetCompoundInterest;

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

            Console.WriteLine(a);
            Console.WriteLine(b);
        }