static void Main() { Customer pesho = new IndividualCustomer("Petar Petrov", "8301125555"); Customer softUni = new CompanyCustomer("SoftUni", "BG 93871904730914"); Account peshoDeposit = new DepositAcount(pesho, 0.7m, 10000); Console.WriteLine("The deposit of pesho is " + peshoDeposit.CalculateInterest(12).ToString("f2")); Console.WriteLine(); Account peshoLoan = new LoanAccount(pesho, 0.9m, 1000); Console.WriteLine("The loan of pesho is " + peshoLoan.CalculateInterest(4).ToString("f2")); Account softuniLoan = new LoanAccount(softUni, 12m, 5000); Console.WriteLine("The loan of softuni is: " + softuniLoan.CalculateInterest(4).ToString("f2")); Console.WriteLine(); Account peshoMortgage = new LoanAccount(pesho, 2m, 5000); Console.WriteLine("The mortgage of pesho is: " + peshoMortgage.CalculateInterest(6).ToString("f2")); Account softuniMortgage = new LoanAccount(softUni, 5m, 1000); Console.WriteLine("The mortgage of softuni is: " + softuniMortgage.CalculateInterest(6).ToString("f2")); Console.WriteLine(); }
static void Main(string[] args) { Customer petar = new IndividualCustomer("Petar Gigov", "8412316466"); Customer softUni = new CompanyCustomer("Software University", "BG25445644"); Account petarDepositAccount = new DepositAccount(petar, 1000m, 3.0m); Console.WriteLine(petarDepositAccount.CalculateInterest(12).ToString("f2")); Console.WriteLine(); Account petarLoanAccount = new LoanAccount(petar, 10000m, 12m); Console.WriteLine(petarLoanAccount.CalculateInterest(4).ToString("f2")); Account softuniLoanAccount = new LoanAccount(softUni, 10000m, 12m); Console.WriteLine(softuniLoanAccount.CalculateInterest(4).ToString("f2")); Console.WriteLine(); Account petarMortgageAccount = new MortgageAccount(petar, 10000m, 12m); Console.WriteLine(petarMortgageAccount.CalculateInterest(12).ToString("f2")); Account softUniMortgageAccount = new MortgageAccount(softUni, 10000m, 12m); Console.WriteLine(softUniMortgageAccount.CalculateInterest(12).ToString("f2")); Console.WriteLine(); }
static void Main() { Customer petar = new IndividualCustomer("Petar Gigov", "8412316466"); Customer softUni = new CompanyCustomer("Software University", "BG25445644"); Account petarDepositAccount = new DepositAccount(10000, 3.0m, petar); Console.WriteLine(petarDepositAccount.CalculateInterest(12).ToString("f2")); Console.WriteLine(); Account petarLoanAccount = new LoanAccount(10000, 12m, petar); Console.WriteLine(petarLoanAccount.CalculateInterest(4).ToString("f2")); Account softuniLoanAccount = new LoanAccount(10000, 12m, softUni); Console.WriteLine(softuniLoanAccount.CalculateInterest(4).ToString("f2")); Console.WriteLine(); Account petarMortgageAccount = new MortgageAccount(10000, 12m, petar); Console.WriteLine(petarMortgageAccount.CalculateInterest(12).ToString("f2")); Account softUniMortgageAccount = new MortgageAccount(10000, 12m, softUni); Console.WriteLine(softUniMortgageAccount.CalculateInterest(12).ToString("f2")); Console.WriteLine(); }
static void Main(string[] args) { ICustomer mitko = new IndividualCustomer("Dimitar Obretenov"); ICustomer alex = new IndividualCustomer("Alex Petrov"); ICustomer rosko = new IndividualCustomer("Rostislav Savov"); ICustomer bobi = new IndividualCustomer("Boqna Ivailova"); ICustomer nikeCompany = new CompanyCustomer("Nike ltd."); ICustomer adidasCompany = new CompanyCustomer("Adidas ltd."); ICustomer pumaCompany = new CompanyCustomer("Puma ltd."); IAccount mortgageAccIndividual = new MortgageAccount(mitko, 5.5m, 1500m); IAccount mortgageAccCompany = new MortgageAccount(nikeCompany, 6m, 3250m); IAccount loanAccIndividual = new LoanAccount(alex, 6.1m, 5000m); IAccount loanAccCompany = new LoanAccount(adidasCompany, 4.1m, 5000m); IAccount depositAccIndividualSmall = new DepositAccount(rosko, 4.5m, 970m); IAccount depositAccIndividualBig = new DepositAccount(bobi, 5m, 1500m); IAccount depostAccCompany = new DepositAccount(pumaCompany, 5.1m, 1700m); List <IAccount> accounts = new List <IAccount>() { mortgageAccIndividual, mortgageAccCompany, loanAccIndividual, loanAccCompany, depositAccIndividualBig, depositAccIndividualSmall, depostAccCompany }; foreach (var account in accounts) { Console.Write("Type customer: {0}, ", account.Customer.GetType().Name); Console.WriteLine("Type account: {0}, ", account.GetType().Name); Console.WriteLine("Calculate interest rate for 2 months: {0}, ", account.CalculateInterestRate(2)); Console.WriteLine("Calculate interest rate for 5 months: {0}, ", account.CalculateInterestRate(5)); Console.WriteLine("Calculate interest rate for 7 months: {0}, ", account.CalculateInterestRate(7)); Console.WriteLine("Calculate interest rate for 13 months: {0}, ", account.CalculateInterestRate(13)); Console.WriteLine(); } }
public static void Main() { ICustomer pesho = new IndividualCustomer("Petar Petrov"); ICustomer agroCompany = new CompanyCustomer("Agro Company Ltd."); IAccount mortgageAccInd = new MortgageAccount(pesho, 10024m, 5.3m); IAccount mortgageAccComp = new MortgageAccount(agroCompany, 10024m, 5.3m); IAccount loanAccInd = new LoanAccount(pesho, 1024m, 5.3m); IAccount loanAccComp = new LoanAccount(agroCompany, 10024m, 5.3m); IAccount depositAccIndBig = new DepositAccount(pesho, 10024m, 5.3m); IAccount depositAccIndSmall = new DepositAccount(pesho, 999m, 5.3m); IAccount depositAccComp = new DepositAccount(agroCompany, 11024m, 4.3m); List<IAccount> accounts = new List<IAccount>() { mortgageAccInd, mortgageAccComp, loanAccInd, loanAccComp, depositAccIndBig, depositAccIndSmall, depositAccComp }; foreach (var acc in accounts) { Console.WriteLine( "{5} {0,-15}: {1:N2}, {2:N2}, {3:N2}, {4:N2}", acc.GetType().Name, acc.CalculateRate(2), acc.CalculateRate(3), acc.CalculateRate(10), acc.CalculateRate(13), acc.Customer.GetType().Name); } }