public CalculateInterest ( int monthsCount ) : decimal | ||
monthsCount | int | |
return | decimal |
public static void Main() { DepositAccount kiro = new DepositAccount(Customers.Individual, 1000m, 5); Console.WriteLine(kiro.CalculateInterest(10) + "\n"); LoanAccount pesho = new LoanAccount(Customers.Individual, 1500m, 3); Console.WriteLine(pesho.CalculateInterest(12) + "\n"); LoanAccount maglaOOD = new LoanAccount(Customers.Company, 1500m, 3); Console.WriteLine(maglaOOD.CalculateInterest(12) + "\n"); MortgageAccount penka = new MortgageAccount(Customers.Individual, 50000m, 2); Console.WriteLine(penka.CalculateInterest(8) + "\n"); MortgageAccount shadyAD = new MortgageAccount(Customers.Company, 250000m, 5); Console.WriteLine(penka.CalculateInterest(12) + "\n"); MortgageAccount shadyOOD = new MortgageAccount(Customers.Company, 250000m, 5); Console.WriteLine(penka.CalculateInterest(24) + "\n"); }
static void Main() { DepositAccount depositPersonAcc = new DepositAccount(Customer.Individual, 10000.00M, 2.5); Console.WriteLine("Individual deposit account(balance = {0}) interest for 12 months = {1:F2}." , depositPersonAcc.Balance, depositPersonAcc.CalculateInterest(12)); Console.WriteLine("Withdrawing from this account 9500."); depositPersonAcc.Withdraw(9500); Console.WriteLine("Individual deposit account(balance = {0}) interest for 12 months = {1:F2}." , depositPersonAcc.Balance, depositPersonAcc.CalculateInterest(12)); Console.WriteLine("Try to withdraw 501."); depositPersonAcc.Withdraw(501); LoanAccount loanPersonAcc = new LoanAccount(Customer.Individual, -15250.35M, 2.0); LoanAccount loanCompanyAcc = new LoanAccount(Customer.Company, -50000, 1.5); Console.WriteLine("\nIndividual loan account(balance = {0}) interest for 3 months = {1:F2}." , loanPersonAcc.Balance, loanPersonAcc.CalculateInterest(3)); Console.WriteLine("Individual loan account(balance = {0}) interest for 10 months = {1:F2}." , loanPersonAcc.Balance, loanPersonAcc.CalculateInterest(10)); Console.WriteLine("Company loan account(balance = {0}) interest for 10 months = {1:F2}." , loanCompanyAcc.Balance, loanCompanyAcc.CalculateInterest(10)); Console.WriteLine("Company loan account(balance = {0}) interest for 2 months = {1:F2}." , loanCompanyAcc.Balance, loanCompanyAcc.CalculateInterest(2)); MortgageAccount mortgagePersonAcc = new MortgageAccount(Customer.Individual, -2500.50M, 3.2); MortgageAccount mortgageCompanyAcc = new MortgageAccount(Customer.Company, -1000M, 1); Console.WriteLine("\nIndividual mortgage account(balance = {0}) interest for 6 months = {1:F2}." , mortgagePersonAcc.Balance, mortgagePersonAcc.CalculateInterest(6)); Console.WriteLine("Individual mortgage account(balance = {0}) interest for 10 months = {1:F2}." , mortgagePersonAcc.Balance, mortgagePersonAcc.CalculateInterest(10)); Console.WriteLine("Individual mortgage account(balance = {0}) interest for 12 months = {1:F2}." , mortgageCompanyAcc.Balance, mortgageCompanyAcc.CalculateInterest(12)); //for first 12 months interest is 60$ Console.WriteLine("Individual mortgage account(balance = {0}) interest for 24 months = {1:F2}." , mortgageCompanyAcc.Balance, mortgageCompanyAcc.CalculateInterest(24)); //for 24 months interest is 60$ for first 12months + 120$ for next 12 months }
static void Main(string[] args) { List<Account> accounts = new List<Account> { new DepositAccount(new Individual("Petar Petrov"), 1000,0.02), new DepositAccount(new Company("CompanyLTD"), 15000,0.02), new DepositAccount(new Individual("Maria Petrova"), 1500,0.05), new MortgageAccount(new Company("CompanyLTD"), 50000,0.04), new MortgageAccount(new Individual("Maria Petrova"), 35000,0.06), new LoanAccount(new Company("CompanyLTD"), 7000,0.08), new DepositAccount(new Individual("Maria Petrova"), 1500,0.0012), }; Bank Investbank = new Bank(accounts); MortgageAccount testPersonalAccount = new MortgageAccount(new Individual("Marcheto"), 1200, 0.02); Console.WriteLine(testPersonalAccount.CalculateInterest(24)); }
static void Main(string[] args) { var b = new Bank("ING"); var c1 = new Individual(); var d = new DepositAccount(b, c1, 1000, 3.85m, 12); Console.WriteLine(d.CalculateInterest()); var l = new LoanAccount(b, c1, 1000, 3.5m, 12); Console.WriteLine(l.CalculateInterest()); var c2 = new Company(); var m = new MortgageAccount(b, c2, 1500, 3.8m, 36); Console.WriteLine(m.CalculateInterest()); }