static void Main() { DepositAccount depos = new DepositAccount(Customer.company,125.66m,0.06m); Console.WriteLine(depos); depos.Deposite(1); Console.WriteLine(depos); depos.Draw(2); Console.WriteLine(depos); Console.WriteLine(depos.CalculateInerestRate(12)); depos.Deposite(1000); Console.WriteLine(depos.CalculateInerestRate(12)); LoanAccount loan = new LoanAccount(Customer.company, 12m, 0.055m); loan.Deposite(500); Console.WriteLine(loan.CalculateInerestRate(5)); MortgageAccount mort = new MortgageAccount(Customer.individual, 100m, 0.05m); Console.WriteLine(mort.CalculateInerestRate(7)); Account[] accounts = new Account[] { depos, loan, mort }; foreach (var account in accounts) { Console.WriteLine(account); } }
static void Main() { Account[] bankAccounts = new Account[6]; bankAccounts[0] = new Deposit("BG13IORT73778100610012", new Individual("Deljan", "Stojanov", "Zlatev", "9801062347", "0899745657", "Varna"), 0.007m); bankAccounts[0].DepositMoney(900m); ((Deposit)bankAccounts[0]).DrawMoney(100m); bankAccounts[1] = new Deposit("BG13IORT73778100610000", new Company("Dimo DZZD", "457456789", "0897234587", "Sofia"), 0.009m); bankAccounts[1].DepositMoney(2000m); bankAccounts[2] = new Loan("BG13IORT73778100610032", new Individual("Stefan", "Zlatev", "Bojanov", "9801062347", "0899745612", "Sofia"), 0.008m); bankAccounts[2].DepositMoney(1000m); bankAccounts[3] = new Loan("BG90IORT73778500650000", new Company("AAA OOD", "985456789", "0897234587", "Sofia"), 0.009m); bankAccounts[3].DepositMoney(1000m); bankAccounts[4] = new Mortgage("BG13IORT73778100610078", new Individual("Zlatina", "Givkova", "Zlateva", "9801062347", "0899745678", "Varna"), 0.005m); bankAccounts[4].DepositMoney(1000m); bankAccounts[5] = new Mortgage("BG85IORT73778600660000", new Company("BBB EOOD", "478456789", "0897234512", "Varna"), 0.009m); bankAccounts[5].DepositMoney(1000m); Console.WriteLine("Interest amount is calculated for 12 months:"); Console.WriteLine(); foreach (var item in bankAccounts) { Console.WriteLine("{0} \nInterest: {1:F2}", item, item.CalculateInterestAmount(12)); } }
//Methods public void AddAccount(Account newAccount) { this.allAccounts.Add(newAccount); }
public void AddAccount(Account account) { this.accounts.Add(account); }
public void RemoveAccount(Account acc) { this.accounts.Remove(acc); }