private decimal interest; // interest rate in % #endregion Fields #region Constructors // default interestRate is 5% per year (0.416% per month) and the default balance is 100.0 public Account(Customer holder, decimal interest = 0.416m, decimal balance = 100.0m) { this.Holder = holder; this.InterestRatePerMonth = interest; this.Balance = balance; this.Holder.Accounts.Add(this); // automatically appends current account to the customer's list of accounts }
static void Main() { Bank MGM = new Bank(); Customer pesho = new Customer(CustomerType.Individual, "Pesho Peshev"); Customer telerik = new Customer(CustomerType.Company, "Telerik AD"); Mortage mortageAccount = new Mortage(pesho, 10000M, 0.666M); Deposit depositAccount = new Deposit(telerik, 10000m, 0.066M); MGM.AddAccount(mortageAccount); MGM.AddAccount(depositAccount); }
public Mortgage(Customer holder, decimal interest = 0.416m, decimal balance = 100.0m) : base(holder, interest, balance) { }
protected Account(Customer customer, decimal balance, decimal interestRate) { this.customer = customer; this.balance = balance; this.interestRate = interestRate; }
public Loan(Customer customer, decimal balance, decimal interestRate) : base(customer, balance, interestRate) { }
public LoanAccount(decimal interestPerMonth, decimal balance, Customer customer) : base(interestPerMonth, balance, customer) { }
public Deposit(Customer customer, decimal balance, decimal interestRate) : base(customer, balance, interestRate) { }
public Deposit(Customer holder, decimal interest = 0.416m, decimal balance = 100.0m) : base(holder, interest, balance) { }
protected Account(decimal interestPerMonth, decimal balance, Customer customer) { this.InterestPerMonth = interestPerMonth; this.Balance = balance; this.Customer = customer; }
public void AddCustomer(Customer customer) { this.bankCustomers.Add(customer); }
public Mortage(Customer customer, decimal balance, decimal interestRate) : base(customer, balance, interestRate) { }