1: public class BankAccount
2: {
3: public BankAccount(int accountAge, int creditScore, AccountInterest accountInterest)
4: {
5: AccountAge = accountAge;
6: CreditScore = creditScore;
7: AccountInterest = accountInterest;
8: }
9:
10: public int AccountAge { get; private set; }
11: public int CreditScore { get; private set; }
12: public AccountInterest AccountInterest { get; private set; }
13: }
14:
15: public class AccountInterest
16: {
17: public BankAccount Account { get; private set; }
18:
19: public AccountInterest(BankAccount account)
20: {
21: Account = account;
22: }
23:
24: public double InterestRate
25: {
26: get { return CalculateInterestRate(); }
27: }
28:
29: public bool IntroductoryRate
30: {
31: get { return CalculateInterestRate() < 0.05; }
32: }
33:
34: public double CalculateInterestRate()
35: {
36: if (Account.CreditScore > 800)
37: return 0.02;
38:
39: if (Account.AccountAge > 10)
40: return 0.03;
41:
42: return 0.05;
43: }
44: }