static void Main() { Account[] accounts = new Account[] { new DepositAccount(new Customer("Ivan", "Ivanonv"), 1000m, 4, 12), new DepositAccount(new Customer("Asen", "Ivanonv"), 2000m, 8, 6), new DepositAccount(new Customer("Kiro", "Asenov"), 8000m, 12, 8), }; foreach (var account in accounts) { Console.WriteLine("{0} {1} - interest amount = {2}", account.Customer.FirstName, account.Customer.LastName, account.CalculateInterestAmount()); } //deposit accc test Console.WriteLine(); DepositAccount depositAcc = new DepositAccount(new CompaniesCustumer("Borislav", "Bliznashki"), 1000m, 3, 6); depositAcc.DepositMoney(1000m); depositAcc.DrawMoneyBank(200m); Console.WriteLine("{0} {1} balance: {2}", depositAcc.Customer.FirstName, depositAcc.Customer.LastName, depositAcc.Balance); //loan acc test LoanAccount loanAcc = new LoanAccount(new IndividualCustumers("Konstantin", "Hadjiev"), 15000m, 12, 12); loanAcc.DepositMoney(11000m); Console.WriteLine("{0} {1} balance: {2}", loanAcc.Customer.FirstName, loanAcc.Customer.LastName, loanAcc.Balance); //mortgage acc test MortgageAccount mortgageAcc = new MortgageAccount(new CompaniesCustumer("Viktor", "Pavlov"), 5000m, 1, 6); mortgageAcc.DepositMoney(10000m); Console.WriteLine("{0} {1} balance: {2}", mortgageAcc.Customer.FirstName, mortgageAcc.Customer.LastName, mortgageAcc.Balance); }
static void Main(string[] args) { DepositAccount depositAcc = new DepositAccount( new Customer(CustomerType.Individual, "Pesho", "Petrov"), 1100m); LoanAccount loanAcc = new LoanAccount( new Customer(CustomerType.Company, "Pesho", "Petrov"), 800m); MortgageAccount mortgageAcc = new MortgageAccount( new Customer(CustomerType.Individual, "Pesho", "Petrov"), 800m); // Uncomment next lines to test Deposit() and Withdraw() //Console.WriteLine(depositAcc); //depositAcc.Deposit(120m); //depositAcc.Withdraw(20000m); //Console.WriteLine(depositAcc); //depositAcc.Withdraw(1220m); //Console.WriteLine(depositAcc); // Uncomment next lines to test CalculateInterestAmount() Console.WriteLine(depositAcc.CalculateInterestAmount(6)); Console.WriteLine(loanAcc.CalculateInterestAmount(12)); Console.WriteLine(mortgageAcc.CalculateInterestAmount(6)); }