static void Main() { DepositAccount depositAccount = new DepositAccount(new Customer("Pesho", "individual"), 1200m, 10m); DepositAccount companyDepositAccount = new DepositAccount(new Customer("Goshos", "company"), 160000m, 8m); LoanAccount loanAccount = new LoanAccount(new Customer("Gosho", "individual"), 8000m, 12m); MortgageAccount morgageAccount = new MortgageAccount(new Customer("Peshovi", "company"), 12000m, 16m); Console.WriteLine("Deposit balanse: " + depositAccount.Balance); depositAccount.Deposit(1000); Console.WriteLine("After deposit 1000: " + depositAccount.Balance); depositAccount.Withdraw(1200); Console.WriteLine("After withdraw 1200: " + depositAccount.Balance); Console.WriteLine(); Console.WriteLine("Loan balanse: " + loanAccount.Balance); loanAccount.Deposit(1000); Console.WriteLine("After deposit 1000: " + loanAccount.Balance); Console.WriteLine(); Console.WriteLine("Morgage balanse: " + morgageAccount.Balance); morgageAccount.Deposit(1000); Console.WriteLine("After deposit 1000: " + morgageAccount.Balance); Console.WriteLine(); Console.WriteLine("Diderent interest calculations: "); Console.WriteLine(depositAccount.CalculateInterest(5)); Console.WriteLine(depositAccount.CalculateInterest(5)); Console.WriteLine(loanAccount.CalculateInterest(3)); Console.WriteLine(loanAccount.CalculateInterest(4)); Console.WriteLine(morgageAccount.CalculateInterest(6)); Console.WriteLine(morgageAccount.CalculateInterest(7)); Console.WriteLine(companyDepositAccount.CalculateInterest(12)); Console.WriteLine(companyDepositAccount.CalculateInterest(13)); }
private static void Main() { // Individual account test Costumer ivan = new Costumer("Ivan Ivanov", CostumerTypes.Individual); DepositAccount ivanDepositAccount = new DepositAccount(ivan, 1, 1000); int months = 5; decimal ivanInterest = ivanDepositAccount.CalculateInterest(months); Console.WriteLine(ivanDepositAccount.ToString() + "\n Interest for {0} months : {1}", months, ivanInterest + "\n"); ivanDepositAccount.Withdraw(500); Console.WriteLine("After withdraw 500 \n" + ivanDepositAccount.ToString() + "\n"); // Company Account test Costumer kokoOod = new Costumer("KOKO OOD", CostumerTypes.Company); LoanAccount kokoLoanAccount = new LoanAccount(kokoOod, 2, 50000); months = 12; decimal kokoInterest = kokoLoanAccount.CalculateInterest(months); Console.WriteLine(kokoLoanAccount.ToString() + "\n Interest for {0} months : {1}", months, kokoInterest + "\n"); months = 13; kokoInterest = kokoLoanAccount.CalculateInterest(months); Console.WriteLine(kokoLoanAccount.ToString() + "\n Interest for {0} months : {1}", months, kokoInterest + "\n"); }
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 = CultureInfo.InvariantCulture; DepositAccount depAccountInd = new DepositAccount(new Individual("Boyko Draganov", "9090909090"), 230m, 0.003m); DepositAccount depAccountComp = new DepositAccount(new Company("Barista", "999999999"), 13000m, 0.006m); MortgageAccount mortAccountInd = new MortgageAccount(new Individual("Georgi Dimitrov", "9090909190"), 2300m, 0.005m); MortgageAccount mortAccountComp = new MortgageAccount(new Company("Sky", "999999999"), 35000m, 0.008m); LoanAccount loanAccountInd = new LoanAccount(new Individual("Hani Kovachev", "9090909190"), 2300m, 0.005m); LoanAccount loanAccountComp = new LoanAccount(new Company("Scraper BG", "999999999"), 5000m, 0.002m); List <Account> accounts = new List <Account>() { depAccountInd, depAccountComp, mortAccountInd, mortAccountComp, loanAccountInd, loanAccountComp }; foreach (var acc in accounts) { Console.WriteLine("I am {0}, I am owned by {1}, my current balance is \n{2} and the interest rate for {3} months is: {4:F2}", acc.GetType(), acc.Customer.GetType(), acc.Balance, 3, acc.CalculateInterest(3)); Console.WriteLine(new string('-', 50)); } depAccountInd.DepositMoney(1000); depAccountInd.WithdrawMoney(130); Console.WriteLine("Deposit Account owned by Individual:\nMy current balance is:{0}, and my interest for 2 months is: {1:F2}", depAccountInd.Balance, depAccountInd.CalculateInterest(2)); }
// Write a program to model the bank system by classes and interfaces. // Identify the classes, interfaces, base classes and abstract actions // and implement the calculation of the interest functionality through overridden methods. private static void Main() { Client client1 = new ClientIndividual("Neo"); Client client2 = new ClientCompany("Office 1"); Client client3 = new ClientIndividual("Nakov"); Account acc1 = new DepositAccount(client1, 5, "BG13TLRK01"); Account acc2 = new LoanAccount(client2, 4.5m, "BG13TLRK02"); Account acc3 = new MortgageAccount(client3, 8.8m, "BG13TLRK03"); acc1.DepositMoney(1000); ((DepositAccount)acc1).WithdrawMoney(500); acc2.DepositMoney(10000); Bank bank = new Bank("New Bank"); bank.AddAccount(acc1); bank.AddAccount(acc2); bank.AddAccount(acc3); Console.WriteLine(bank.Accounts); Console.WriteLine(); Console.WriteLine("IBAN: {0} ({1}), Interest: {2:F2}", acc1.IBAN, acc1.Owner.Name, acc1.CalculateInterest(5)); Console.WriteLine("IBAN: {0} ({1}), Interest: {2:F2}", acc2.IBAN, acc2.Owner.Name, acc2.CalculateInterest(6)); Console.WriteLine("IBAN: {0} ({1}), Interest: {2:F2}", acc3.IBAN, acc3.Owner.Name, acc3.CalculateInterest(18)); Console.WriteLine("\nRemoving account 1"); bank.RemoveAccount(acc1); Console.WriteLine(bank.Accounts); }
static void Main() { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; DepositAccount depAccountInd = new DepositAccount(new Individual("Boyko Draganov", "9090909090"), 230m, 0.003m); DepositAccount depAccountComp = new DepositAccount(new Company("Barista", "999999999"), 13000m, 0.006m); MortgageAccount mortAccountInd = new MortgageAccount(new Individual("Georgi Dimitrov", "9090909190"), 2300m, 0.005m); MortgageAccount mortAccountComp = new MortgageAccount(new Company("Sky", "999999999"), 35000m, 0.008m); LoanAccount loanAccountInd = new LoanAccount(new Individual("Hani Kovachev", "9090909190"), 2300m, 0.005m); LoanAccount loanAccountComp = new LoanAccount(new Company("Scraper BG", "999999999"), 5000m, 0.002m); List<Account> accounts = new List<Account>(){depAccountInd, depAccountComp, mortAccountInd, mortAccountComp, loanAccountInd, loanAccountComp}; foreach (var acc in accounts) { Console.WriteLine("I am {0}, I am owned by {1}, my current balance is \n{2} and the interest rate for {3} months is: {4:F2}", acc.GetType(), acc.Customer.GetType(), acc.Balance, 3, acc.CalculateInterest(3)); Console.WriteLine(new string('-', 50)); } depAccountInd.DepositMoney(1000); depAccountInd.WithdrawMoney(130); Console.WriteLine("Deposit Account owned by Individual:\nMy current balance is:{0}, and my interest for 2 months is: {1:F2}", depAccountInd.Balance, depAccountInd.CalculateInterest(2)); }
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() { // Making instances of all types of accounts with the two types of customers DepositAccount first = new DepositAccount(new IndividualCustomer("Jimmy Hendrix"), 1500, 5); DepositAccount second = new DepositAccount(new CompanyCustomer("Jimmy Hendrix"), 500, 5); LoanAccount third = new LoanAccount(new IndividualCustomer("Jimmy Hendrix"), 4000, 7); LoanAccount fourth = new LoanAccount(new CompanyCustomer("Jimmy Hendrix"), 50000, 3); MortgageAccount fifth = new MortgageAccount(new IndividualCustomer("Jimmy Hendrix"), 34000, 4); MortgageAccount sixth = new MortgageAccount(new CompanyCustomer("Jimmy Hendrix"), 19000, 9); // Testing the DepositMoney, WithDrawMoney and CalculateInterest methods for all account types Console.WriteLine("INDIVIDUAL DEPOSIT ACCOUNT:"); Console.WriteLine("Balance: {0}", first.Balance); first.DepositMoney(10); Console.WriteLine("Balance after deposit: {0}", first.Balance); first.WithDrawMoney(150); Console.WriteLine("Balance after withdraw: {0}", first.Balance); Console.WriteLine("Calculate interest: {0}", first.CalculateInterest(5)); Console.WriteLine(); Console.WriteLine("CUSTOMER DEPOSIT ACCOUNT: "); Console.WriteLine("Balance: {0}", second.Balance); second.DepositMoney(2000); Console.WriteLine("Balance after deposit: {0}", second.Balance); second.WithDrawMoney(1800); Console.WriteLine("Balance after withdraw: {0}", second.Balance); Console.WriteLine("Calculate interest: {0}", second.CalculateInterest(9)); Console.WriteLine(); Console.WriteLine("INDIVIDUAL LOAN ACCOUNT:"); Console.WriteLine("Balance: {0}", third.Balance); third.DepositMoney(60); Console.WriteLine("Balance after deposit: {0}", third.Balance); Console.WriteLine("Calculate interest: {0}", third.CalculateInterest(7)); Console.WriteLine(); Console.WriteLine("CUSTOMER LOAN ACCOUNT:"); Console.WriteLine("Balance: {0}", fourth.Balance); fourth.DepositMoney(60); Console.WriteLine("Balance after deposit: {0}", fourth.Balance); Console.WriteLine("Calculate interest: {0}", fourth.CalculateInterest(9)); Console.WriteLine(); Console.WriteLine("INDIVIDUAL MORTGAGE ACCOUNT:"); Console.WriteLine("Balance: {0}", fifth.Balance); fifth.DepositMoney(100); Console.WriteLine("Balance after deposit: {0}", fifth.Balance); Console.WriteLine("Calculate interest: {0}", fifth.CalculateInterest(6)); Console.WriteLine(); Console.WriteLine("CUSTOMER MORTGAGE ACCOUNT:"); Console.WriteLine("Balance: {0}", sixth.Balance); sixth.DepositMoney(100); Console.WriteLine("Balance after deposit: {0}", sixth.Balance); Console.WriteLine("Calculate interest: {0}", sixth.CalculateInterest(11)); // Testing the Bank class and the AddAccount method Bank newBank = new Bank(LoadList()); Console.WriteLine(); newBank.AddAccount(new DepositAccount(new IndividualCustomer("Joe Rogan"), 780, 3)); Console.WriteLine("Type of customer: " + newBank.Accounts[6].Customer.GetType().Name); Console.WriteLine("Name: " + newBank.Accounts[6].Customer.Name); Console.WriteLine("Balance: " + newBank.Accounts[6].Balance); Console.WriteLine("Interest rate: " + newBank.Accounts[6].InterestRate); }
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)); }
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() { LoanAccount loanAcc = new LoanAccount(new Individual("Georgi", 28, "1122334455"), 1000, 7); Console.WriteLine(loanAcc.CalculateInterest(6)); DepositAccount depositAcc = new DepositAccount(new Company("SoftUni Ltd.", 1, "1122334455"), 1000, 7); Console.WriteLine(depositAcc.CalculateInterest(6)); MortgageAccount mortgageAcc = new MortgageAccount(new Individual("Pesho", 20, "1122334455"), 1000, 7); Console.WriteLine(mortgageAcc.CalculateInterest(6)); }
static void Main(string[] args) { Customer cust = new IndividualCustomer("Pesho"); //Customer cust = new CompanyCustomer("Pesho"); //Account acc = new LoanAccount(cust, 100, 0.06M); //Account acc = new MortgageAccount(cust, 100, 0.06M); Account acc = new DepositAccount(cust, 1200, 0.06M); Console.WriteLine(acc.CalculateInterest(12)); }
static void Main() { Customer customer = Customer.Individual; DepositAccount account = new DepositAccount(customer, 1500, 5); Console.WriteLine(account.CalculateInterest(5)); account.DepositMoney(2500); account.WithDraw(500); Console.WriteLine(account.Balance); }
static void Main() { IndividualCustomer Bobo = new IndividualCustomer("Bobo"); CompanyCustomer Komfo = new CompanyCustomer("Komfo"); DepositAccount firstDeposit = new DepositAccount(Bobo, 800, 15); LoanAccoint secondDeposit = new LoanAccoint(Komfo, 2299, 19); Console.WriteLine("Balance {0}: {1:#.##} lv.; Interest: {2:0.##}" , firstDeposit.Customer.Name, firstDeposit.Balance, firstDeposit.CalculateInterest(12)); firstDeposit.DepositMoney(600); Console.WriteLine("Balance {0}: {1:#.##} lv.; Interest: {2:0.##}" , firstDeposit.Customer.Name, firstDeposit.Balance, firstDeposit.CalculateInterest(12)); Console.WriteLine("Balance {0}: {1:#.##} lv.; Interest: {2:0.##}" , secondDeposit.Customer.Name, secondDeposit.Balance, secondDeposit.CalculateInterest(2)); Console.WriteLine(); Console.WriteLine("Balance {0}: {1:#.##} lv.; Interest: {2:0.##}" , secondDeposit.Customer.Name, secondDeposit.Balance, secondDeposit.CalculateInterest(6)); MortgageAccount death = new MortgageAccount(Bobo, 750, 15); MortgageAccount metal = new MortgageAccount(Komfo, 1000, 15); Console.WriteLine("Balance {0}: {1:#.##} lv.; Interest: {2:0.##}" , death.Customer.Name, death.Balance, death.CalculateInterest(6)); Console.WriteLine("Balance {0}: {1:#.##} lv.; Interest: {2:0.##}" , death.Customer.Name, death.Balance, death.CalculateInterest(7)); Console.WriteLine(); Console.WriteLine("Balance {0}: {1:#.##} lv.; Interest: {2:0.##}" , metal.Customer.Name, metal.Balance, metal.CalculateInterest(12)); Console.WriteLine("Balance {0}: {1:#.##} lv.; Interest: {2:0.##}" , metal.Customer.Name, metal.Balance, metal.CalculateInterest(24)); }
public static void Main() { DepositAccount depositAcc = new DepositAccount(new Customer(CustomerType.Company), 1000m, 5.7m); LoanAccount loanAcc = new LoanAccount(new Customer(CustomerType.Individual), 5000m, 7m); MortgageAccount mortgageAcc = new MortgageAccount(new Customer(CustomerType.Individual), 100000m, 5m); Console.WriteLine(depositAcc.CalculateInterest(2) + "%"); Console.WriteLine(loanAcc.CalculateInterest(24) + "%"); Console.WriteLine(mortgageAcc.CalculateInterest(15) + "%"); depositAcc.WithdrawMoney(200m); Console.WriteLine(depositAcc.Balance); loanAcc.DepositMoney(900m); Console.WriteLine(loanAcc.Balance); }
static void Main() { Account Ivan = new DepositAccount("Ivan", 975.34, 5.3, AccountType.Individual); Console.WriteLine(Ivan.CalculateInterest(12).ToString("f2")); Console.WriteLine(); Account Peter = new DepositAccount("Peter", 1637.94, 1.3, AccountType.Individual); Console.WriteLine(Peter.CalculateInterest(12).ToString("f2")); Console.WriteLine(); Account Misho = new MortgageAccount("Misho", 4457.23, 7.3, AccountType.Individual); Console.WriteLine(Misho.CalculateInterest(12).ToString("f2")); Console.WriteLine(); }
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() { 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() { //in my opition accounts should have DateTime property "startDate" or something for //the time of the account openning nad months should be calculated with DateTime.Now - startDate //but we cannot test the program this way, so months are entered in the constructors // //Also calculate interest should add the interest to the main balance but I did not add that because //in the task is not exactly clear DepositAccount deposit = new DepositAccount(new Individual("Pesho", 21, "Male"), 7.5m, 15); deposit.DepositMoney(10000m); System.Console.WriteLine(deposit.CalculateInterest()); deposit.WithdrawMoney(5000m); System.Console.WriteLine(deposit.Balance); LoanAccount loan = new LoanAccount(new Company("Pesho ltd.", "00000153265"), 5.5m, 10); loan.DepositMoney(50000m); System.Console.WriteLine(loan.CalculateInterest()); }
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)); }