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); }
private static void Main() { var compoundCalculator = new InterestCalculator(500, 5.6, 10, GetCompoundInterest); Console.WriteLine(compoundCalculator); var simpleCalculator = new InterestCalculator(2500, 7.2, 15, GetSimpleInterest); Console.WriteLine(simpleCalculator); }
static void Main() { Func<double, double, int, double> something = GetSimpleInterests; Func<double, double, int, double> something2 = GetCompoundInterest; InterestCalculator test = new InterestCalculator(500.5, 5.5, 5, something); Console.WriteLine(test); }
public static void Main() { var compound = new InterestCalculator(500, 5.6, 10, GetCompoundInterest); Console.WriteLine(compound); var simple = new InterestCalculator(2500, 7.2, 15, GetSimpleInterest); Console.WriteLine(simple); }
public TheInterestCalculator(decimal sum, decimal interest, int years, InterestCalculator calculationMethod) { this.Sum = sum; this.Interest = interest; this.Years = years; this.calculationMethod = calculationMethod; // this.Balance = moneyBalance; }
static void Main(string[] args) { Func<decimal, decimal, int, decimal> simple = GetSimpleInterest; Func<decimal, decimal, int, decimal> compound = GetCompoundInterest; var icalc1 = new InterestCalculator(500m, 5.6m, 10, compound); var icalc2 = new InterestCalculator(2500m, 7.2m, 15, simple); Console.WriteLine(icalc1); Console.WriteLine(icalc2); }
static void Main(string[] args) { Func <decimal, decimal, int, decimal> simple = Extensions.GetSimpleInterest; Func <decimal, decimal, int, decimal> compound = Extensions.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() { CalculateInterest compoundInterestDelegate = GetCompoundInterest; InterestCalculator compoundInterestCalculator = new InterestCalculator(500, 5.6m, 10, compoundInterestDelegate); Console.WriteLine(compoundInterestCalculator.InterestCalculationDelegate( compoundInterestCalculator.Money, compoundInterestCalculator.InterestRate, compoundInterestCalculator.Years)); CalculateInterest simpleInterestDelegate = GetSimpleInterest; InterestCalculator simpleInterestCalculator = new InterestCalculator(2500, 7.2m, 15, simpleInterestDelegate); Console.WriteLine(simpleInterestCalculator.InterestCalculationDelegate( simpleInterestCalculator.Money, simpleInterestCalculator.InterestRate, simpleInterestCalculator.Years)); }