static void Main() { IAccount depositIndividualAccount = new DepositAccount(Customer.Individual, 120.00m, 21.00m); DepositAccount depositCompany = new DepositAccount(Customer.Company, 240.00m, 25.00m); IAccount loanIndividial = new LoanAccount(Customer.Individual, 20.00m, 15.00m); IAccount loanCompany = new LoanAccount(Customer.Company, 200.00m, 17.00m); IAccount mortgageIndividial = new MortgageAccount(Customer.Individual, 2000.00m, 5.00m); IAccount mortgageCompany = new MortgageAccount(Customer.Company, 5000.00m, 7.00m); Console.WriteLine("Deposit individial account CalculateInterestAmountForPeriod for 5 month is ${0}", depositIndividualAccount.CalculateInterestAmountForPeriod(5)); Console.WriteLine("Deposit individial account Balance before deposit is ${0}", depositIndividualAccount.Balance); depositIndividualAccount.Deposit(50); Console.WriteLine("Deposit individial account Balance after deposit is ${0}", depositIndividualAccount.Balance); Console.WriteLine("Deposit company account CalculateInterestAmountForPeriod for 2 month is ${0}", depositCompany.CalculateInterestAmountForPeriod(2)); Console.WriteLine("Deposit company account Balance before draw money is ${0}", depositCompany.Balance); depositCompany.DrawMoney(2000); Console.WriteLine("Deposit company account Balance after draw money is ${0}", depositCompany.Balance); Console.WriteLine("Loan individial account CalculateInterestAmountForPeriod for 2 month is ${0}", loanIndividial.CalculateInterestAmountForPeriod(2)); Console.WriteLine("Loan company account CalculateInterestAmountForPeriod for 1 month is ${0}", loanCompany.CalculateInterestAmountForPeriod(1)); Console.WriteLine("Mortgage individial account CalculateInterestAmountForPeriod for 6 month is ${0}", mortgageIndividial.CalculateInterestAmountForPeriod(6)); Console.WriteLine("Mortgage company account CalculateInterestAmountForPeriod for 7 month is ${0}", mortgageCompany.CalculateInterestAmountForPeriod(7)); }
public static void Main() { Bank bank = new Bank(); Customer pesho = new Customer("Pesho", CustomerType.Individual); Customer milko = new Customer("Milko", CustomerType.Individual); Customer jichka = new Customer("jichka", CustomerType.Individual); Customer dell = new Customer("Dell", CustomerType.Company); Customer hp = new Customer("HP", CustomerType.Company); Customer apple = new Customer("Apple", CustomerType.Company); DepositAccount peshoAccount = new DepositAccount(pesho, 4300, 2.2m); LoanAccount milkoAccount = new LoanAccount(milko, 9999, 3.7m); MortgageAccount jichkaAccount = new MortgageAccount(jichka, 559, 1.2m); Account dellAccount = new DepositAccount(dell, 17631782.4234m, 7.1m); Account hpAccount = new LoanAccount(hp, 111111.1114m, 4.4m); Account appleAccount = new MortgageAccount(apple, 1888631782.4934234m, 11.1m); peshoAccount.Deposit(400.50m); peshoAccount.Withdraw(200); bank.AddAccount(peshoAccount); bank.AddAccount(milkoAccount); bank.AddAccount(jichkaAccount); bank.AddAccount(dellAccount); bank.AddAccount(hpAccount); bank.AddAccount(appleAccount); foreach (IAccount account in bank.Accounts) { Console.WriteLine($"{account} -- with interest for 23 months -> {account.CalculateInterest(23):F1}\n"); } }
static void Main() { Customer examplePerson = new Customer("Example Person", CustomerType.Individual); Customer exampleCompany = new Customer("Example Company", CustomerType.Company); DepositAccount deposit = new DepositAccount(examplePerson, 1200, (decimal)0.02); int period = 2; Console.WriteLine("Interest for: {0}, account type: {1}, balance: {2}, period: {3} months, interest rate: {4}%\n{5}%", deposit.Customer, deposit.GetType(), deposit.Balance, period, deposit.IntrestRate, deposit.CalcInterestAmount(period)); deposit.Withdraw(300); Console.WriteLine("Interest for: {0}, account type: {1}, balance: {2}, period: {3} months, interest rate: {4}%\n{5}%", deposit.Customer, deposit.GetType(), deposit.Balance, period, deposit.IntrestRate, deposit.CalcInterestAmount(period)); deposit.Deposit(1000); Console.WriteLine("Test depositing money balance: {0}", deposit.Balance); period = 3; Loan loan = new Loan(examplePerson, 1200, (decimal)0.02); Console.WriteLine("Interest for: {0}, account type: {1}, balance: {2}, period: {3} months, interest rate: {4}%\n{5}%", loan.Customer, loan.GetType(), loan.Balance, period, loan.IntrestRate, loan.CalcInterestAmount(period)); period = 4; Console.WriteLine("Interest for: {0}, account type: {1}, balance: {2}, period: {3} months, interest rate: {4}%\n{5}%", loan.Customer, loan.GetType(), loan.Balance, period, loan.IntrestRate, loan.CalcInterestAmount(period)); loan.Deposit(1200); Console.WriteLine("After repaying the loan the balance is: {0}", loan.Balance); //invalid period test //Console.WriteLine(loan.CalcInterestAmount(-3)); }
static void Main() { Customers kris = new Individuals("Kris", "65654756765", "Sofia", new DateTime(1990, 10, 25)); Customers krisOOD = new Companies("Kris OOD", "65654656765", "Plovdiv", 325343); Console.WriteLine(krisOOD is Individuals); Console.WriteLine(kris is Individuals); Bank mortgageAccTest = new MortgageAccount(200.2m, 0.6m, kris); Bank mortgageAccTest1 = new MortgageAccount(200.2m, 0.6m, krisOOD); Console.WriteLine(mortgageAccTest.CalculateInterest(15)); Console.WriteLine(mortgageAccTest1.CalculateInterest(15)); Bank loanAccTest = new LoanAccount(200.2m, 0.6m, kris); Bank loanAccTest1 = new LoanAccount(200.2m, 0.6m, krisOOD); Console.WriteLine(loanAccTest.CalculateInterest(11)); Console.WriteLine(loanAccTest1.CalculateInterest(11)); Bank depositAccTest = new DepositAccount(3200.2m, 0.6m, kris); Bank depositAccTest1 = new DepositAccount(1200.2m, 0.6m, krisOOD); Console.WriteLine(depositAccTest.CalculateInterest(11)); Console.WriteLine(depositAccTest1.CalculateInterest(11)); depositAccTest.Deposit(200); Console.WriteLine(depositAccTest.Balance); var depositAcc = depositAccTest as DepositAccount; depositAcc.Draw(300); Console.WriteLine(depositAcc.Balance); }
static void Main() { Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Customer depositAccountCustomer = new IndividualCustomer( "2343PJ34752", "William", "Harris", "1 Microsoft Way, Redmond, WA", "1-888-553-6562"); DepositAccount depositAccount = new DepositAccount( depositAccountCustomer, 2500, 1.0825M, 12); Customer loanAccountCustomer = new CorporateCustomer( "89BPQ123YJ0", "Oracle Corporation", "500 Oracle Parkway, Redwood Shores, Redwood City, California, United States", "1-981-717-9366"); Account loanAccount = new LoanAccount( loanAccountCustomer, 1000000000, 1.0931M, 24); Customer mortgageLoanAccountCustomer = new IndividualCustomer( "97A20LX3YJU", "Ginni", "Rometty", "Armonk, New York, U.S.", "1-129-342-3817"); Account mortgageLoanAccount = new MortgageLoanAccount( mortgageLoanAccountCustomer, 300000, 1.0875M, 36); decimal depositInterest = depositAccount.CalculateInterest(3); Console.WriteLine("Deposit account interest: {0:C2}", depositInterest); depositAccount.Deposit(459.76M); depositAccount.Withdraw(400.76M); Console.WriteLine("Deposit account balance: {0:C2}", depositAccount.Balance); decimal loanInterest = loanAccount.CalculateInterest(10); Console.WriteLine("Loan account interest: {0:C2}", loanInterest); decimal mortgageLoanInterest = mortgageLoanAccount.CalculateInterest(10); Console.WriteLine("Mortgage loan account interest: {0:C2}", mortgageLoanInterest); }
static void Main(string[] args) { DepositAccount dep = new DepositAccount(Customers.companies, 2154); dep.Deposit(12); Console.WriteLine(dep.Balance); dep.CalculateInterestAmount(8); Console.WriteLine(dep.InterestAmount); MortgageAccount mort = new MortgageAccount(Customers.individuals, 56); mort.CalculateInterestAmount(2); Console.WriteLine(mort.InterestAmount); dep.Deposit(12313); Console.WriteLine(dep.Balance); }
static void Main() { Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Customer depositAccountCustomer = new IndividualCustomer( "123456789AA", "Pesho", "Peshov", "Sofia, Bulgaria, Tzarigradsko shose 2", "555-123-123"); DepositAccount depositAccount = new DepositAccount( depositAccountCustomer, 2000, 0.1234M, 36); Customer loanAccountCustomer = new CorporateCustomer( "123456789AB", "Oracle Corporation", "Sofia, Bulgaria, Tzarigradsko shose 20", "555-123-321"); Account loanAccount = new LoanAccount( loanAccountCustomer, 9000000000, 0.1234M, 24); Customer mortgageLoanAccountCustomer = new IndividualCustomer( "223456789AA", "Ginni", "Rometty", "Sofia, Bulgaria, Tzarigradsko shose 22", "555-321-321"); Account mortgageLoanAccount = new MortgageLoanAccount( mortgageLoanAccountCustomer, 990000, 0.1234M, 12); decimal depositInterest = depositAccount.CalculateInterest(3); Console.WriteLine("Deposit account interest: {0:C2}", depositInterest); depositAccount.Deposit(459.76M); depositAccount.Withdraw(400.76M); Console.WriteLine("Deposit account balance: {0:C2}", depositAccount.Balance); decimal loanInterest = loanAccount.CalculateInterest(10); Console.WriteLine("Loan account interest: {0:C2}", loanInterest); decimal mortgageLoanInterest = mortgageLoanAccount.CalculateInterest(10); Console.WriteLine("Mortgage loan account interest: {0:C2}", mortgageLoanInterest); }
static void Main() { string textSeparator = new string('-', 80); Console.WriteLine(textSeparator); DepositAccount IvanAccount = new DepositAccount(new Customer("Ivan Ivanov", CustomerType.Individual), 500M, 4.6M); IvanAccount.Deposit(1150); IvanAccount.Withdraw(250); var interstDeposit = IvanAccount.CalculateInterest(13); IvanAccount.Deposit(interstDeposit); Console.WriteLine("Current DepositAccount balance of customer: {0} is {1:c2} ", IvanAccount.Customer.CustomerName, IvanAccount.Balance); Console.WriteLine(textSeparator); LoanAccount GeorgiAccount = new LoanAccount(new Customer("Georgi Petrov", CustomerType.Individual), 1000M, 4.6M); GeorgiAccount.Deposit(1500); var interstDepositOfGosho = GeorgiAccount.CalculateInterest(9); GeorgiAccount.Deposit(interstDeposit); Console.WriteLine("Current LoanAccount balance of customer: {0} is {1:c2} ", GeorgiAccount.Customer.CustomerName, GeorgiAccount.Balance); Console.WriteLine(textSeparator); MortgageAccount companyAccount = new MortgageAccount(new Customer("Maznata Mucka LTD", CustomerType.Company), 1000M, 4.6M); companyAccount.Deposit(1500); var interstDepositOfCompany = companyAccount.CalculateInterest(11); companyAccount.Deposit(interstDeposit); Console.WriteLine("Current MortgageAccount balance of customer: {0} is {1:c2} ", companyAccount.Customer.CustomerName, companyAccount.Balance); Console.WriteLine(textSeparator); }
static void Main(string[] args) { DepositAccount account; // Deposit Ivan Ivanov account = new DepositAccount(new IndividualCustomer("Ivan", "Ivanov"), 0m, 3.1m); Console.WriteLine(account); Console.WriteLine("Interest rate for 3 months is " + account.CalculateInterest(3)); Console.WriteLine("Deposit 1000"); account.Deposit(1000); System.Console.WriteLine(account); Console.WriteLine("Interest rate for 3 months is " + account.CalculateInterest(3)); // Deposit company Apple account = new DepositAccount(new CompanyCustomer("Apple"), 0m, 1m); Console.WriteLine(account); Console.WriteLine("Interest rate for 3 months is " + account.CalculateInterest(3)); Console.WriteLine("Deposit 1000000"); account.Deposit(1000000); System.Console.WriteLine(account); Console.WriteLine("Interest rate for 3 months is " + account.CalculateInterest(3)); LoanAccount account1; // Loan Microsoft account1 = new LoanAccount(new CompanyCustomer("Microsoft"), 1000000m, 3m); Console.WriteLine(account1); Console.WriteLine("Interest rate for 3 months is " + account1.CalculateInterest(3)); Console.WriteLine("Deposit 1000"); account1.Deposit(1000); System.Console.WriteLine(account1); Console.WriteLine("Interest rate for 3 months is " + account1.CalculateInterest(3)); MortageAccount account2; // Loan Atanas Georgiev account2 = new MortageAccount(new IndividualCustomer("Atanas", "Georgiev"), 10000m, 5.1m); Console.WriteLine(account2); Console.WriteLine("Interest rate for 3 months is " + account2.CalculateInterest(3)); Console.WriteLine("Deposit 1000"); account2.Deposit(1000); System.Console.WriteLine(account2); Console.WriteLine("Interest rate for 13 months is " + account2.CalculateInterest(13)); }
public void TestDepositMethod() { Customer accountCustomer = new IndividualCustomer( "2343PJ34752", "William", "Harris", "1 Microsoft Way, Redmond, WA", "1-888-553-6562"); Account account = new DepositAccount( accountCustomer, 32500, 1.0825M, 12); account.Deposit(459M); Assert.AreEqual(32959M, account.Balance); }
static void Main() { Console.WriteLine("----------Loan Account(Company)----------\n"); LoanAccount accountOne = new LoanAccount(CustomerType.Company, 50000, 500, 24); accountOne.CalculateInterest(); accountOne.Deposit(500); Console.WriteLine("\n\n----------Loan Account(Individual)----------\n"); LoanAccount accountTwo = new LoanAccount(CustomerType.Individual, 50000, 500, 24); accountTwo.CalculateInterest(); accountTwo.Deposit(500); Console.WriteLine("\n\n----------Mortage Account(Company)----------\n"); MortageAccount accountThree = new MortageAccount(CustomerType.Company, 100000, 1000, 36); accountThree.CalculateInterest(); accountThree.Deposit(10000); Console.WriteLine("\n\n----------Mortage Account(Individual)----------\n"); MortageAccount accountFour = new MortageAccount(CustomerType.Individual, 100000, 1000, 36); accountFour.CalculateInterest(); accountFour.Deposit(10000); Console.WriteLine("\n\n----------Deposit Account(Company)----------\n"); DepositAccount accountFive = new DepositAccount(CustomerType.Company, 500000, 5000, 24); accountFive.CalculateInterest(); accountFive.Deposit(100000); accountFive.Withdraw(200000); Console.WriteLine("\n\n----------Deposit Account(Individual)----------\n"); DepositAccount accountSix = new DepositAccount(CustomerType.Individual, 500000, 5000, 24); accountSix.CalculateInterest(); accountSix.Deposit(100000); accountSix.Withdraw(200000); Console.WriteLine("\n\n----------Deposit Account(Balance under 1000)----------\n"); DepositAccount accountSeven = new DepositAccount(CustomerType.Individual, 500, 50, 6); accountSeven.CalculateInterest(); accountSeven.Deposit(50); accountSeven.Withdraw(150); Console.WriteLine("\n\n\n"); }
static void Main(string[] args) { Customer facebook = new Customer("company"); Customer Stephan = new Customer("individual"); DepositAccount deposit = new DepositAccount(facebook, 1100, 3); deposit.Withdraw(400); Console.WriteLine(deposit.Balance); // 1100 - 400 = 700 deposit.Deposit(500); Console.WriteLine(deposit.Balance); // 700 + 500 = 1200 LoanAccount loan = new LoanAccount(Stephan, 2000, 2); loan.Deposit(1000); Console.WriteLine(loan.Interest(12)); // 2000 * (1 + (2 * 12)/100) MortgageAccount mortgage = new MortgageAccount(facebook, 1000, 10); Console.WriteLine(mortgage.Interest(13)); }
static void Main() { // Customers Customer[] customers = new Customer[4]; customers[0] = new IndividualCustomer("Iliqn Petrov", 59784, "0894719648"); customers[1] = new CompanieCustomer("Kiril Iliev", 81746, "0881446720"); customers[2] = new IndividualCustomer("Nikolai Grancharov", 91002, "0874100359"); customers[3] = new CompanieCustomer("Kiril Slavqnov", 00147, "0886979231"); // Accounts DepositAccount firstDeposit = new DepositAccount(customers[0], 3000, 0.10m, 12); BankAccount[] accounts = new BankAccount[5]; accounts[0] = firstDeposit; accounts[1] = new LoanAccount(customers[1], 5000, 0.08m, 6); accounts[2] = new LoanAccount(customers[2], 5000, 0.08m, 6); accounts[3] = new MortgageAccount(customers[2], 22900, 0.11m, 48); accounts[4] = new MortgageAccount(customers[3], 22900, 0.11m, 48); // Print 1 Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("First Print ..."); Console.ResetColor(); foreach (var item in accounts) { Console.WriteLine(item); Console.WriteLine(); } // Withdraw & Deposit firstDeposit.Withdraw(250); firstDeposit.Deposit(600); // Print 2 Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Second Print ..."); Console.ResetColor(); Console.WriteLine(accounts[0]); Console.ReadLine(); }
public static void Main() { var testAcount = new DepositAccount(new Company("Abc", "040304123"), 3.47m); Console.WriteLine(testAcount); Console.WriteLine(testAcount.Deposit(1200m)); Console.WriteLine(testAcount.Withdraw(101m)); Console.WriteLine("Interest: " + testAcount.CalculateInterest(10)); Console.WriteLine(testAcount); Console.WriteLine(new string('-', 60)); var anotherTestAccount = new MortgageAccount(new Company("Apple", "040304123"), 5); Console.WriteLine(anotherTestAccount); Console.WriteLine(anotherTestAccount.Deposit(120m)); Console.WriteLine("Interest:" + anotherTestAccount.CalculateInterest(13)); Console.WriteLine(anotherTestAccount); Console.WriteLine(new string('-', 60)); var yetAnotherTestAccount = new LoanAccount(new Individual("Gosho","8010271234"),4.2m); Console.WriteLine(yetAnotherTestAccount); Console.WriteLine(yetAnotherTestAccount.Deposit(180m)); Console.WriteLine("Interest: " + yetAnotherTestAccount.CalculateInterest(3)); Console.WriteLine(yetAnotherTestAccount); Console.WriteLine(new string('-', 60)); }
public static void Main(string[] args) { var a1 = new DepositAccount("Kevin", "individual", 1000, 0.015); var a2 = new LoanAccount("Dep", "individual", 30000, 0.07); var a3 = new MortgageAccount("IVS LLC", "company", 80000, 0.04); var a4 = new MortgageAccount("John", "individual", 80000, 0.04); a1.DisplayAccountInfo(); a2.DisplayAccountInfo(); a3.DisplayAccountInfo(); a4.DisplayAccountInfo(); a1.InterestAfterMonths(12); a2.InterestAfterMonths(12); a3.InterestAfterMonths(12); a4.InterestAfterMonths(12); a1.Deposit(100); a2.Deposit(12); a1.Withdraw(100); }
public static void Main() { List<IAccount> accounts = new List<IAccount> { new LoanAccount(new Company("Jurassic Pork"), 10000m, 9.4), new MortgageAccount(new Individual("Batman"), 0.01m, 4), new DepositAccount(new Individual("Bai Nakov"), 1000m, 2.6), }; foreach (var account in accounts) { Console.WriteLine(account); } DepositAccount floristGumpAccount = new DepositAccount(new Company("Florist Gump"), 17500m, 5.5); floristGumpAccount.Withdraw(2500); floristGumpAccount.Deposit(1000); Console.WriteLine(floristGumpAccount); // Should be 16000 Console.WriteLine(); Console.WriteLine(floristGumpAccount.Customer.Name + " -> " + floristGumpAccount.CalcInterest(4)); floristGumpAccount.Withdraw(15500); //Console.WriteLine(floristGumpAccount.CalcInterest(8)); // Should throw exception IAccount papaRazziPizza = new LoanAccount(new Company("Papa Razzi"), 25000m, 9.4); Console.WriteLine(papaRazziPizza.Customer.Name + " -> " +papaRazziPizza.CalcInterest(2)); IAccount baiSvetlin = new MortgageAccount(new Individual("Bai Nakov"), 1000m, 2.6); Console.WriteLine(baiSvetlin.Customer.Name + " -> " + baiSvetlin.CalcInterest(8)); //Console.WriteLine(baiSvetlin.Customer.Name + " -> " + baiSvetlin.CalcInterest(4)); // Should throw exception IAccount dejaBrewAccount = new MortgageAccount(new Company("Deja Brew Brewery"), 8000, 2.6); Console.WriteLine(dejaBrewAccount.Customer.Name + " -> " + dejaBrewAccount.CalcInterest(1)); }