Ejemplo n.º 1
0
        public static void Main()
        {
            Customer       ivan = new IndividualCustomer("Ivan");
            DepositAccount ivanDepositAccount = new DepositAccount(ivan, 500M, 4M);

            Console.WriteLine(ivanDepositAccount.Client.Name);
            Console.WriteLine(ivanDepositAccount.InterestRate);
            ivanDepositAccount.Deposit(100M);
            Console.WriteLine(ivanDepositAccount.Balance);
            ivanDepositAccount.Withdraw(100);
            Console.WriteLine(ivanDepositAccount.Balance);
            Console.WriteLine(ivanDepositAccount.CalculateInterest(5));
            Console.WriteLine(ivanDepositAccount);

            Customer        company = new CompanyCustomer("Company");
            MortgageAccount companyMortgageAcount = new MortgageAccount(company, 100000M, 1.5M);

            Console.WriteLine(companyMortgageAcount.Client.Name);
            Console.WriteLine(companyMortgageAcount);
            companyMortgageAcount.Deposit(10000);
            Console.WriteLine(companyMortgageAcount.Balance);
            companyMortgageAcount.CalculateInterest(20);

            LoanAccount companyLoanAccount = new LoanAccount(company, 25000M, 5M);

            Console.WriteLine(companyLoanAccount);
            companyLoanAccount.Deposit(5000.50M);
            Console.WriteLine(companyLoanAccount.CalculateInterest(30));
            Console.WriteLine(companyLoanAccount);
        }
Ejemplo n.º 2
0
        public static void Main()
        {
            Console.WriteLine("Deposit Account: ");

            var depositAcc = new DepositAccount(new Individual("Katya Ivanova", 213, new DateTime(1996, 5, 21), Gender.Female), 200000, 4);

            Console.WriteLine(depositAcc.ToString());
            depositAcc.AddMoney(20000);
            depositAcc.WithdrawMoney(213);

            Console.WriteLine("{0} Interest amount: {1}%", depositAcc.GetType().Name, depositAcc.InterestAmount(8)); // interest amount method

            Console.WriteLine(new string('-', 50));

            var companyDeposit = new DepositAccount(new Company("Apple", 12345, "Steve Jobs"), 52342343, 234);

            Console.WriteLine(companyDeposit.ToString());

            Console.WriteLine(new string('-', 50));

            Console.WriteLine("Loan Deposit: ");
            var loanDeposit = new LoanAccount(new Individual("Dimitur Topchev", 213, new DateTime(1992, 12, 14), Gender.Male), 2000, 2);

            Console.WriteLine(loanDeposit.ToString());
            Console.WriteLine("Interest amount {0}%", loanDeposit.InterestAmount(12));
            loanDeposit.AddMoney(23456);

            Console.WriteLine(new string('-', 50));

            Console.WriteLine("Mortgage Deposit");
            var mortgageAcc = new MortgageAccount(new Company("BFFS", 12383128, "Golemata Hazna"), 2500000, 0.1m);

            Console.WriteLine(mortgageAcc.ToString());
            Console.WriteLine("Interest amount {0}%", mortgageAcc.InterestAmount(12));
        }
Ejemplo n.º 3
0
        public static void Main()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            var deposit = new DepositAccount(customer: Customer.Company, balance: 200, interestRate: 20);

            Console.WriteLine("Deposit account's Interest Amount: {0}", deposit.CalculateInterestAmount(months: 6));

            // when balance is more than 1000
            deposit.Deposit(900m);
            Console.WriteLine("Deposit account's Interest Amount: {0}\n", deposit.CalculateInterestAmount(months: 6));

            // individual
            var loanIndividual = new LoanAccount(customer: Customer.Individual, balance: 100, interestRate: 15);

            Console.WriteLine("Loan individual account's Interest Amount: {0}", loanIndividual.CalculateInterestAmount(months: 3));
            Console.WriteLine("Loan individual account's Interest Amount: {0}\n", loanIndividual.CalculateInterestAmount(months: 5));

            // company
            var loanCompany = new LoanAccount(customer: Customer.Company, balance: 100, interestRate: 15);

            Console.WriteLine("Loan company account's Interest Amount: {0}", loanCompany.CalculateInterestAmount(months: 2));
            Console.WriteLine("Loan company account's Interest Amount: {0}\n", loanCompany.CalculateInterestAmount(months: 5));

            // individual
            var mortIndividual = new MortgageAccount(customer: Customer.Individual, balance: 350, interestRate: 5);

            Console.WriteLine("Mortgage individual account's Interest Amount: {0}", mortIndividual.CalculateInterestAmount(months: 7));
            Console.WriteLine("Mortgage individual account's Interest Amount: {0}\n", mortIndividual.CalculateInterestAmount(months: 8));

            // company
            var mortCompany = new MortgageAccount(customer: Customer.Company, balance: 20000, interestRate: 15);

            Console.WriteLine("Mortgage company account's Interest Amount: {0}", mortCompany.CalculateInterestAmount(months: 10));
            Console.WriteLine("Mortgage company account's Interest Amount: {0}\n", mortCompany.CalculateInterestAmount(months: 24));
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        static void Main()
        {
            Customer kircho = new Individual("a001", "Kiro", "8503122535", new DateTime(1990, 10, 25));

            Customer firmata = new Company("a002", "p2p", "503122535");

            Console.WriteLine(firmata is Individual);
            Console.WriteLine(kircho is Individual);

            BankAccount mortgageAccTest = new MortgageAccount(200.2m, 0.6m, kircho);
            BankAccount mortgageAccTest1 = new MortgageAccount(200.2m, 0.6m, firmata);

            Console.WriteLine(mortgageAccTest.CalculateInterest(15));
            Console.WriteLine(mortgageAccTest1.CalculateInterest(15));

            BankAccount loanAccTest = new LoanAccount(200.2m, 0.6m, kircho);
            BankAccount loanAccTest1 = new LoanAccount(200.2m, 0.6m, firmata);

            Console.WriteLine(loanAccTest.CalculateInterest(11));
            Console.WriteLine(loanAccTest1.CalculateInterest(11));

            BankAccount depositAccTest = new DepositAccount(3200.2m, 0.6m, kircho);
            BankAccount depositAccTest1 = new DepositAccount(1200.2m, 0.6m, firmata);

            Console.WriteLine(depositAccTest.CalculateInterest(11));
            Console.WriteLine(depositAccTest1.CalculateInterest(11));

            depositAccTest.Deposit(200);
            Console.WriteLine(depositAccTest.Balance);
            var depositAcc = depositAccTest as DepositAccount;
            depositAcc.Withdraw(300);
            Console.WriteLine(depositAcc.Balance);
        }
Ejemplo n.º 6
0
        static void Main()
        {
            Customer individual = new Individual("Some Individual");
            Customer company = new Company("Some Company");
            Customer otherIndividual = new Individual("SomeOther Individual");
            Customer otherCompany = new Company("SomeOther Company");


            Account individualLoanAccount = new LoanAccount(individual, 2000, 2);
            decimal interest = individualLoanAccount.CalculateInterestAmount(5);

            Console.WriteLine(interest);

            Account companyMortgageAccount = new MortgageAccount(company, 20000, 3);
            interest = companyMortgageAccount.CalculateInterestAmount(5);

            Console.WriteLine(interest);

            Account depositIndividualAccount = new DepositAccount(individual, 900, 1.5M);
            depositIndividualAccount.Deposit(1000);
            interest = depositIndividualAccount.CalculateInterestAmount(2);
            Console.WriteLine(interest);


        }
Ejemplo n.º 7
0
        static void Main()
        {
            DepositAccount depos = new DepositAccount(Customer.company,125.66m,0.06m);
            Console.WriteLine(depos);
            depos.Deposite(1);
            Console.WriteLine(depos);
            depos.Draw(2);
            Console.WriteLine(depos);
            Console.WriteLine(depos.CalculateInerestRate(12));
            depos.Deposite(1000);
            Console.WriteLine(depos.CalculateInerestRate(12));

            LoanAccount loan = new LoanAccount(Customer.company, 12m, 0.055m);
            loan.Deposite(500);
            Console.WriteLine(loan.CalculateInerestRate(5));

            MortgageAccount mort = new MortgageAccount(Customer.individual, 100m, 0.05m);
            Console.WriteLine(mort.CalculateInerestRate(7));

            Account[] accounts = new Account[] { depos, loan, mort };
            foreach (var account in accounts)
            {
                Console.WriteLine(account);
            }
        }
        static void Main()
        {
            Customer kircho = new Individual("a001", "Kiro", "8503122535", new DateTime(1990, 10, 25), Gender.Male);

            Customer firmata = new Company("a002", "p2p", "503122535");

            Console.WriteLine(firmata is Individual);
            Console.WriteLine(kircho is Individual);

            BankAccount mortgageAccTest  = new MortgageAccount(200.2m, 0.6m, kircho);
            BankAccount mortgageAccTest1 = new MortgageAccount(200.2m, 0.6m, firmata);

            Console.WriteLine(mortgageAccTest.CalculateInterest(15));
            Console.WriteLine(mortgageAccTest1.CalculateInterest(15));

            BankAccount loanAccTest  = new LoanAccount(200.2m, 0.6m, kircho);
            BankAccount loanAccTest1 = new LoanAccount(200.2m, 0.6m, firmata);

            Console.WriteLine(loanAccTest.CalculateInterest(11));
            Console.WriteLine(loanAccTest1.CalculateInterest(11));

            BankAccount depositAccTest  = new DepositAccount(3200.2m, 0.6m, kircho);
            BankAccount depositAccTest1 = new DepositAccount(1200.2m, 0.6m, firmata);

            Console.WriteLine(depositAccTest.CalculateInterest(11));
            Console.WriteLine(depositAccTest1.CalculateInterest(11));

            depositAccTest.Deposit(200);
            Console.WriteLine(depositAccTest.Balance);
            var depositAcc = depositAccTest as DepositAccount;

            depositAcc.Withdraw(300);
            Console.WriteLine(depositAcc.Balance);
        }
Ejemplo n.º 9
0
        public static void Run()
        {
            Account[] depositAccount = new Account[]
            {
                new DepositAccount(new Customer(CustomerType.Individuals, "Stamat Sedefov", "Pernik", "0899115011"), 150M, 5M),
                new DepositAccount(new Customer(CustomerType.Companies, "Telus", "Sofia", "*88"), 100000M, 18M),
                new DepositAccount(new Customer(CustomerType.Companies, "Apple", "California, USA", "555-123-123"), 50000M, 3M)
            };

            Account[] loanAccont = new Account[]
            {
                new LoanAccount(new Customer(CustomerType.Companies, "Vivacom", "Sofia", "02/55113"), 400M, 1M),
                new LoanAccount(new Customer(CustomerType.Individuals, "Gosho Peshov", "Veliko Tarnovo", "033-12-3"), 1M, 2M),
                new LoanAccount(new Customer(CustomerType.Individuals, "Mariika Toshova", "Burgas", "044-22-4"), 155M, 11M)
            };

            Account[] mortgageAccount = new Account[]
            {
                new MortgageAccount(new Customer(CustomerType.Individuals, "Blagoy Berbatov", "London", "024-44-44"), 1500M, 10M),
                new MortgageAccount(new Customer(CustomerType.Individuals, "Qlo Yolov", "Burgas", "08855123"), 444M, 2M),
                new MortgageAccount(new Customer(CustomerType.Companies, "Vivacom", "Sofia", "011-23-3"), 111M, 1M)
            };

            Console.WriteLine("---------- Deposit accounts ----------");
            PrintAccounts.Print(depositAccount);

            Console.WriteLine("---------- Loan accounts ----------");
            PrintAccounts.Print(loanAccont);

            Console.WriteLine("---------- Mortgage accounts ----------");
            PrintAccounts.Print(mortgageAccount);

            Console.WriteLine("---------- Mitko deposit accounts ----------");
            DepositAccount mitkoDepositeAccount = new DepositAccount(new Customer(CustomerType.Individuals, "Mitko Mitkov", "Pleven", "044-2222-2"), 500M, 12M);

            mitkoDepositeAccount.Deposit(111M);
            mitkoDepositeAccount.Withdraw(11M);
            Console.WriteLine("Mitko balance: " + mitkoDepositeAccount.Balance);
            Console.WriteLine();

            Console.WriteLine("---------- Asus loan accounts ----------");
            LoanAccount asusLoanAccount = new LoanAccount(new Customer(CustomerType.Companies, "ASUS", "Taiwan", "000111"), 199900M, 14M);

            asusLoanAccount.Deposit(1313M);
            Console.WriteLine("ASUS balande: " + asusLoanAccount.Balance);
            Console.WriteLine();

            Console.WriteLine("---------- Lenovo mortgage accounts ----------");
            MortgageAccount lenovoMortgageAccount = new MortgageAccount(new Customer(CustomerType.Companies, "LENOVO", "China", "0991100"), 33333M, 100M);

            lenovoMortgageAccount.Deposit(10000M);
            Console.WriteLine("Lenovo balance: " + lenovoMortgageAccount.Balance);
            Console.WriteLine();
        }
Ejemplo n.º 10
0
        static void Main()
        {
            DepositAccount  depositAccount  = new DepositAccount(Customer.companies, 900.00, 6.8);
            LoanAccount     loanAccount     = new LoanAccount(Customer.companies, 5000.00, 7.1);
            MortgageAccount mortrageAccount = new MortgageAccount(Customer.individuals, 20000.00, 8.0);

            //Deposit accounts have no interest if their balance is positive and less than 1000.
            Console.WriteLine("Deposit account for 6 months(Balance: 900.00): {0:F2}", depositAccount.depositMoney(6));
            //Loan accounts have no interest for the first 3 months if are held by individuals and for the first 2 months if are held by a company.
            Console.WriteLine("Loan account for 3 months for a company(Interest rate:7.1): {0:F2}", loanAccount.depositMoney(3));
            //Mortgage accounts have ½ interest for the first 12 months for companies and no interest for the first 6 months for individuals.
            Console.WriteLine("Mortrage account for 8 months for individual customer(Interest rate:8.0): {0:F2}", mortrageAccount.depositMoney(8));
        }
Ejemplo n.º 11
0
        static void Main()
        {
            List <Customer> customers = new List <Customer>
            {
                new IndividualCustomer("Pepo"),
                new IndividualCustomer("Tsura"),
                new IndividualCustomer("Vaso"),
                new CompanyCustomer("Software AG"),
                new CompanyCustomer("C3i"),
                new CompanyCustomer("Schneider Electric")
            };

            DepositAccount pepoDepAcc = new DepositAccount(customers[0], 300, 30);

            pepoDepAcc.DepositAmount(80);
            pepoDepAcc.WithdrawAmount(120);
            Console.WriteLine("Pepo's balance: {0}", pepoDepAcc.Balance);
            Console.WriteLine("Calculate Pepo's interest rate: {0}", pepoDepAcc.CalculateInterestRate(10));

            LoanAccount tsuraLoanAcc = new LoanAccount(customers[1], 800, 70);

            tsuraLoanAcc.DepositAmount(489);
            Console.WriteLine("Tsura's balance: {0}", tsuraLoanAcc.Balance);
            Console.WriteLine("Calculate Tsura's interest rate: {0}", tsuraLoanAcc.CalculateInterestRate(2));

            MortgageAccount vasoMortAcc = new MortgageAccount(customers[2], 500, 20);

            vasoMortAcc.DepositAmount(1000);
            Console.WriteLine("Vaso's balance: {0}", vasoMortAcc.Balance);
            Console.WriteLine("Calculate Vaso's interest rate: {0}", vasoMortAcc.CalculateInterestRate(12));

            DepositAccount softAgDepAcc = new DepositAccount(customers[3], 20000, 30);

            softAgDepAcc.DepositAmount(1000);
            softAgDepAcc.WithdrawAmount(20000);
            Console.WriteLine("Software AG's balance: {0}", softAgDepAcc.Balance);
            Console.WriteLine("Calculate Software AG's interest rate: {0}", softAgDepAcc.CalculateInterestRate(2));

            LoanAccount c3iLoanAcc = new LoanAccount(customers[4], 15000, 20);

            c3iLoanAcc.DepositAmount(700);
            Console.WriteLine("C3i's balance: {0}", c3iLoanAcc.Balance);
            Console.WriteLine("Calculate C3i's interest rate: {0}", c3iLoanAcc.CalculateInterestRate(10));

            MortgageAccount schneiderMortAcc = new MortgageAccount(customers[5], 90000, 50);

            schneiderMortAcc.DepositAmount(10000);
            Console.WriteLine("Schneider Electric's balance: {0}", schneiderMortAcc.Balance);
            Console.WriteLine("Calculate Schneider Electric's interest rate: {0}", schneiderMortAcc.CalculateInterestRate(20));
        }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            LoanAccount     loan     = new LoanAccount(new Customer(TypeOfCustomer.IndividualClient, "Pesho Goshev", 123963), 12500, 1, 2);
            DepositAccount  deposit  = new DepositAccount(new Customer(TypeOfCustomer.CompanyClient, "Boc-Boc OOD", 789369), 5000000, 5, 3);
            MortgageAccount mortgage = new MortgageAccount(new Customer(TypeOfCustomer.IndividualClient, "Gosho Peshev", 159357), 147258, 4, 8);


            loan.Deposit(100);
            Console.WriteLine("The ballance of {0} is : {1}", loan.Customer.CustomerName, loan.Ballance);
            Console.WriteLine("The customer ID of {0} is : {1}", deposit.Customer.CustomerName, deposit.Customer.customerID);
            Console.WriteLine("The ballance of {0} is : {1}", deposit.Customer.CustomerName, deposit.Ballance);
            deposit.Deposit(100000);
            Console.WriteLine("The ballance of {0} after deposit is : {1}", deposit.Customer.CustomerName, deposit.Ballance);
            mortgage.InterestAmount(3);
        }
Ejemplo n.º 13
0
        static void Main()
        {
            // Deposit Account Tests
            Console.WriteLine("Deposit Account Test:");
            Console.WriteLine();

            var individualDeposit = new DepositAccount(new Individual("Joro Ivanov", 666, new DateTime(1995, 3, 8), GenderType.Male), 100000, 3);

            Console.WriteLine("Before depositing and withdrawing money");
            Console.WriteLine(individualDeposit);
            individualDeposit.DepositMoney(15600);
            individualDeposit.WithdrawMoney(854);
            Console.WriteLine("After depositing and withdrawing money");
            Console.WriteLine(individualDeposit);

            Console.WriteLine("{0} Interest amount: {1}%", individualDeposit.GetType().Name, individualDeposit.InterestAmount(8));

            Console.WriteLine(new string('-', 50));

            var companyDeposit = new DepositAccount(new Company("Batman Inc", 1, "Bruce Wayne"), 200006, 111);

            Console.WriteLine(companyDeposit);

            Console.WriteLine(new string('-', 50));

            // Loan Account Tests
            Console.WriteLine("Loan Account Test:");
            Console.WriteLine();

            var loanAccount = new LoanAccount(new Individual("Penka Draganova", 5, new DateTime(1990, 11, 21), GenderType.Female), 1000, 2);

            Console.WriteLine(loanAccount);
            Console.WriteLine("Interest amount {0}%", loanAccount.InterestAmount(12));
            loanAccount.DepositMoney(2000);     // Paying the loan

            Console.WriteLine(new string('-', 50));

            // Mortgage Account Tests
            Console.WriteLine("Mortgage Account Test:");
            Console.WriteLine();

            var mortgageAcc = new MortgageAccount(new Company("Ivo's Company", 19500, "Ivo"), 280000, 5.5m);

            Console.WriteLine(mortgageAcc);
            Console.WriteLine("Interest amount {0}%", mortgageAcc.InterestAmount(12));
        }
Ejemplo n.º 14
0
        static void Main(string[] args)
        {
            Bank bank = new Bank("FirstBank");

            Customer       P        = new Customer("Diana", CustomerType.Individuals);
            DepositAccount deposit1 = new DepositAccount(P, 15000, 3.45);

            bank.AddAccount(deposit1);

            Customer        Z      = new Customer("Gosho", CustomerType.Companies);
            MortgageAccount mortg1 = new MortgageAccount(Z, 50000, 5);

            bank.AddAccount(mortg1);

            Console.WriteLine(bank);

            for (int i = 0; i < bank.AllAccounts.Count; i++)
            {
                Console.WriteLine();
                Console.WriteLine("Account {0}: ", i + 1);
                Console.WriteLine(bank.AllAccounts[i]);
            }

            Console.WriteLine("---------- Mitko deposit accounts ----------");
            DepositAccount a = new DepositAccount(new Customer("Maria Daea", CustomerType.Individuals), 5000, 12);

            a.MakeDeposit(111000);
            a.Withdraw(5);
            Console.WriteLine("Totz balance: " + a.Balance);
            Console.WriteLine();

            Console.WriteLine("---------- AHA loan accounts ----------");
            LoanAccount asusLoanAccount = new LoanAccount(new Customer("Adria", CustomerType.Companies), 34567, 12);

            asusLoanAccount.MakeDeposit(10000);
            Console.WriteLine("AHA balance: " + asusLoanAccount.Balance);
            Console.WriteLine();

            Console.WriteLine("---------- B mortgage accounts ----------");
            MortgageAccount b = new MortgageAccount(new Customer("B", CustomerType.Companies), 345565, 50);

            b.MakeDeposit(1000);
            Console.WriteLine("B balance: " + b.Balance);
            Console.WriteLine();
        }
        static void Main()
        {
            var customer = new DepositAccount(Customer.Individual, 3000, 6.7);
            var anotherCustomer = new MortgageAccount(Customer.Company, 15.5M, 9.9);

            Console.WriteLine(customer.CalculateInterestRate(12));

            Console.WriteLine(customer.Balance);

            customer.Deposit(505.5M);
            Console.WriteLine(customer.Balance);

            var accounts = new Bank("UBB");
            accounts.AddAccount(customer);
            accounts.AddAccount(anotherCustomer);

            Console.WriteLine(accounts.ToString());
        }
        static void Main()
        {
            List<Customer> customers = new List<Customer>
            {
                new IndividualCustomer("Pepo"),
                new IndividualCustomer("Tsura"),
                new IndividualCustomer("Vaso"),
                new CompanyCustomer("Software AG"),
                new CompanyCustomer("C3i"),
                new CompanyCustomer("Schneider Electric")
            };

            DepositAccount pepoDepAcc = new DepositAccount(customers[0], 300, 30);
            pepoDepAcc.DepositAmount(80);
            pepoDepAcc.WithdrawAmount(120);
            Console.WriteLine("Pepo's balance: {0}", pepoDepAcc.Balance);
            Console.WriteLine("Calculate Pepo's interest rate: {0}", pepoDepAcc.CalculateInterestRate(10));

            LoanAccount tsuraLoanAcc = new LoanAccount(customers[1], 800, 70);
            tsuraLoanAcc.DepositAmount(489);
            Console.WriteLine("Tsura's balance: {0}", tsuraLoanAcc.Balance);
            Console.WriteLine("Calculate Tsura's interest rate: {0}", tsuraLoanAcc.CalculateInterestRate(2));

            MortgageAccount vasoMortAcc = new MortgageAccount(customers[2], 500, 20);
            vasoMortAcc.DepositAmount(1000);
            Console.WriteLine("Vaso's balance: {0}", vasoMortAcc.Balance);
            Console.WriteLine("Calculate Vaso's interest rate: {0}", vasoMortAcc.CalculateInterestRate(12));

            DepositAccount softAgDepAcc = new DepositAccount(customers[3], 20000, 30);
            softAgDepAcc.DepositAmount(1000);
            softAgDepAcc.WithdrawAmount(20000);
            Console.WriteLine("Software AG's balance: {0}", softAgDepAcc.Balance);
            Console.WriteLine("Calculate Software AG's interest rate: {0}", softAgDepAcc.CalculateInterestRate(2));

            LoanAccount c3iLoanAcc = new LoanAccount(customers[4], 15000, 20);
            c3iLoanAcc.DepositAmount(700);
            Console.WriteLine("C3i's balance: {0}", c3iLoanAcc.Balance);
            Console.WriteLine("Calculate C3i's interest rate: {0}", c3iLoanAcc.CalculateInterestRate(10));

            MortgageAccount schneiderMortAcc = new MortgageAccount(customers[5], 90000, 50);
            schneiderMortAcc.DepositAmount(10000);
            Console.WriteLine("Schneider Electric's balance: {0}", schneiderMortAcc.Balance);
            Console.WriteLine("Calculate Schneider Electric's interest rate: {0}", schneiderMortAcc.CalculateInterestRate(20));
        }
Ejemplo n.º 17
0
        static void Main()
        {
            var customer        = new DepositAccount(Customer.Individual, 3000, 6.7);
            var anotherCustomer = new MortgageAccount(Customer.Company, 15.5M, 9.9);


            Console.WriteLine(customer.CalculateInterestRate(12));

            Console.WriteLine(customer.Balance);

            customer.Deposit(505.5M);
            Console.WriteLine(customer.Balance);

            var accounts = new Bank("UBB");

            accounts.AddAccount(customer);
            accounts.AddAccount(anotherCustomer);

            Console.WriteLine(accounts.ToString());
        }
Ejemplo n.º 18
0
        static void Main(string[] args)
        {
            var b = new Bank("BCR");

            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());
        }
Ejemplo n.º 19
0
        static void Main()
        {
            List <Account> accaunt = new List <Account>()
            {
                new MortgageAccount(new Individual("Gosho"), 1200, 5),
                new MortgageAccount(new Company("CEZ"), 1500, 10),
                new LoanAccount(new Individual("Gosho"), 10000, 5),
                new LoanAccount(new Company("CEZ"), 12000, 12),
                new DepositAccount(new Individual("Gosho"), 20000, 2),
                new DepositAccount(new Company("CEZ"), 4000, 5),
            };

            foreach (var item in accaunt)
            {
                Console.WriteLine(item);
            }

            var acc = new MortgageAccount(new Individual("Gosho"), 1200, 5);

            Console.WriteLine(acc.CalculateInterestRate(18));
        }
Ejemplo n.º 20
0
        static void Main()
        {
            IndividualCustomer inCustomerPesho = new IndividualCustomer("Pesho");
            CompanyCustomer comCustomerGoshoOOD = new CompanyCustomer("Gosho OOD");

            DepositAccount peshoDepositAcc = new DepositAccount(inCustomerPesho,500m);
            LoanAccount goshoLoanAcc = new LoanAccount(comCustomerGoshoOOD, 600m);
            MortgageAccount goshoMorAcc = new MortgageAccount(comCustomerGoshoOOD,550m);

            Console.WriteLine("\tPesho acc info");
            Console.WriteLine();

            Console.WriteLine("Balance in the begining: {0}",peshoDepositAcc.Balance);
            peshoDepositAcc.DepositAmount(6000m);
            Console.WriteLine("Balance after deposit: {0}",peshoDepositAcc.Balance);
            peshoDepositAcc.WithdrawAmount(100m);
            Console.WriteLine("Balance after withdraw: {0}",peshoDepositAcc.Balance);
            Console.WriteLine("Interest Amount: " + peshoDepositAcc.CalculateInterestAmount(50));

            Console.WriteLine();
            Console.WriteLine(new string('-',30));
            Console.WriteLine();
            Console.WriteLine("\t Gosho loan acc info");
            Console.WriteLine();

            Console.WriteLine("Balance in the begining: {0}",goshoLoanAcc.Balance);
            goshoLoanAcc.DepositAmount(50000m);
            Console.WriteLine("Balance after deposit: {0}",goshoLoanAcc.Balance);
            Console.WriteLine("Interest Amount: " + goshoLoanAcc.CalculateInterestAmount(25));
            Console.WriteLine();
            Console.WriteLine(new string('-', 30));
            Console.WriteLine();
            Console.WriteLine("\t Gosho Mortgage acc info");
            Console.WriteLine();

            Console.WriteLine("Balance in the begining: {0}",goshoMorAcc.Balance);
            goshoMorAcc.DepositAmount(50);
            Console.WriteLine("Balance after deposit: {0}",goshoMorAcc.Balance);
            Console.WriteLine("Interest Amount: " + goshoMorAcc.CalculateInterestAmount(5));
        }
Ejemplo n.º 21
0
        static void Main()
        {
            var individual = new Individual("Petar Petrov");
            var company    = new Company("Mobiltel EAD");

            var depositAccountInd  = new DepositAccount(3, 600, individual);
            var depositAccountComp = new DepositAccount(2, 6000, company);

            depositAccountInd.Deposit(50);
            depositAccountComp.Withdraw(1000);
            Console.WriteLine($"Individual balance in deposit account before interest: {depositAccountInd.Balance:F2}.");
            Console.WriteLine($"Company balance in deposit account before interest: {depositAccountComp.Balance:F2}.");

            var individualInterest = depositAccountInd.CalculateInterest(12);
            var companyInterest    = depositAccountComp.CalculateInterest(12);

            Divide();
            Console.WriteLine($"Individual balance after 12 months interest in deposit account: {individualInterest:F2}. (less than 1000 balance => no interest)");
            Console.WriteLine($"Company balance after 12 months interest in deposit account: {companyInterest:F2}.");
            var loanAcccountInd  = new LoanAccount(7, 650, individual);
            var loanAcccountComp = new LoanAccount(9, 5000, company);

            individualInterest = loanAcccountInd.CalculateInterest(12);
            companyInterest    = loanAcccountComp.CalculateInterest(12);
            Divide();
            Console.WriteLine($"Individual balance after 12 months interest in loan account: {individualInterest:F2}.");
            Console.WriteLine($"Company balance after 12 months interest in loan account: {companyInterest:F2}.");

            var mortageAccountInd  = new MortgageAccount(7, 650, individual);
            var mortageAccountComp = new MortgageAccount(9, 5000, company);

            individualInterest = mortageAccountInd.CalculateInterest(12);
            companyInterest    = mortageAccountComp.CalculateInterest(12);
            Divide();
            Console.WriteLine($"Individual balance after 12 months interest in mortage account: {individualInterest:F2}.");
            Console.WriteLine($"Company balance after 12 months interest in mortage account: {companyInterest:F2}.");
        }
Ejemplo n.º 22
0
        public static void Main()
        {
            // Some tests
            Console.WriteLine("Deposit Account: ");

            var depositAcc = new DepositAccount(new Individual("Tanya Skovska", 213, new DateTime(1994, 5, 26), Gender.Female), 200000, 4);

            Console.WriteLine(depositAcc.ToString());
            depositAcc.AddMoney(20000);
            depositAcc.WithdrawMoney(213);

            Console.WriteLine("{0} Interest amount: {1}%", depositAcc.GetType().Name, depositAcc.InterestAmount(8)); // interest amount method

            Console.WriteLine(new string('-', 50));

            var companyDeposit = new DepositAccount(new Company("Microsoft INC", 12345, "Bil Geits"), 44352423432, 234);

            Console.WriteLine(companyDeposit.ToString());

            Console.WriteLine(new string('-', 50));

            Console.WriteLine("Loan Deposit: ");
            var loanDeposit = new LoanAccount(new Individual("Pesho Peshov", 213, new DateTime(1990, 12, 16), Gender.Male), 2000, 2);

            Console.WriteLine(loanDeposit.ToString());
            Console.WriteLine("Interest amount {0}%", loanDeposit.InterestAmount(12));
            loanDeposit.AddMoney(23456);

            Console.WriteLine(new string('-', 50));

            Console.WriteLine("Mortgage Deposit");
            var mortgageAcc = new MortgageAccount(new Company("BFS", 12383128, "Golqmata Peruka"), 2500000, 0.1m);

            Console.WriteLine(mortgageAcc.ToString());
            Console.WriteLine("Interest amount {0}%", mortgageAcc.InterestAmount(12));
        }
        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);
        }