public InterestCalculator(decimal sumMoney, decimal interest, int years, CalculateInterestDelegate delegat)
 {
     this.SumMoney = sumMoney;
     this.Interest = interest;
     this.Years = years;
     this.TotalSum = delegat(sumMoney, interest, years);
 }
Esempio n. 2
0
 public InterestCalculator(double money, double interest, int years, CalculateInterestDelegate calc)
 {
     this.Money = money;
     this.Interest = interest;
     this.Years = years;
     this.Result = calc(money, interest, years);
 }
Esempio n. 3
0
 public InterestCalculator(decimal money, double interest, int years, CalculateInterestDelegate interestCalculationDelegate)
 {
     this.Money    = money;
     this.Interest = interest;
     this.Years    = years;
     this.InterestCalculationDelegate = interestCalculationDelegate;
 }
Esempio n. 4
0
 public InterestCalculator(decimal sumMoney, decimal interest, int years, CalculateInterestDelegate delegat)
 {
     this.SumMoney = sumMoney;
     this.Interest = interest;
     this.Years    = years;
     this.TotalSum = delegat(sumMoney, interest, years);
 }
 public InterestCalculator(decimal money, double interest, int years, CalculateInterestDelegate interestCalculationDelegate)
 {
     this.Money = money;
     this.Interest = interest;
     this.Years = years;
     this.InterestCalculationDelegate = interestCalculationDelegate;
 }
    static void Main()
    {
        CalculateInterestDelegate delegateSimpleInterest = new CalculateInterestDelegate(InterestCalculator.GetSimpleInterest);
        InterestCalculator calculateSimpleInterest = new InterestCalculator(2500, 7.2, 15, delegateSimpleInterest);
        Console.WriteLine(calculateSimpleInterest);

        CalculateInterestDelegate delegateCompoundInterest = new CalculateInterestDelegate(InterestCalculator.GetCompoundInterest);
        InterestCalculator calculateCompoundInterest = new InterestCalculator(500, 5.6, 10, delegateCompoundInterest);
        Console.WriteLine(calculateCompoundInterest);
    }
Esempio n. 7
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);
        }