public decimal CalculateInterest(IAccount account) { var amount = account.SumTransactions(); if (amount <= 0) return 0; return amount * 0.001m; }
public decimal CalculateInterest(IAccount account) { var amount = account.SumTransactions(); if (amount <= 0) return 0; if (amount <= 1000) return amount * 0.001m; else return 1 + (amount - 1000) * 0.002m; }
public decimal CalculateInterest(IAccount account) { var amount = account.SumTransactions(); if (amount <= 0) return 0; DateTime tenDaysPrior = DateTime.Now.AddDays(-10); bool hasWithdrawalsInTenDaysPrior = account.Transactions.Any(t => t.transactionType == Model.TransactionTypes.Withdrawal && t.transactionDate >= tenDaysPrior); if (hasWithdrawalsInTenDaysPrior) return amount * 0.001m; return amount * 0.05m; }