Exemple #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);
        }
Exemple #2
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));
        }
Exemple #3
0
        static void Main()
        {
            //Deposit Test
            var depositAccIndividual = new DepositAccount(CustomerType.Individual, 2000.78m, 0.5m);

            Console.WriteLine("Customer: {0} | Balance: ${1:F2} | Interest Amount (12 Months): ${2:F2}",
                              depositAccIndividual.Customer, depositAccIndividual.Balance, depositAccIndividual.InterestAmount(12));

            depositAccIndividual.Withdraw(1500);
            Console.WriteLine("Balance after Withdraw: ${0:F2}", depositAccIndividual.Balance);
            Console.WriteLine();

            //Loan Test
            var loanAccCompany = new LoanAccount(CustomerType.Company, 3000000.1234m, 1.0m);

            Console.WriteLine("Customer: {0} | Balance: ${1:F2} | Interest Amount (1 Month): ${2:F2}",
                              loanAccCompany.Customer, loanAccCompany.Balance, loanAccCompany.InterestAmount(1));

            loanAccCompany.Deposit(1500000);
            Console.WriteLine("Balance after Deposit: ${0:F2}", loanAccCompany.Balance);
            Console.WriteLine("Interest Amount (13 Months): ${0:F2}", loanAccCompany.InterestAmount(13));
            Console.WriteLine();

            //Mortage Test
            var mortageAccCompany = new MortageAccount(CustomerType.Company, 17000000.98m, 1.5m);

            Console.WriteLine("Customer: {0} | Balance: ${1:F2} | Interest Amount (1 Month): ${2:F2}",
                              mortageAccCompany.Customer, mortageAccCompany.Balance, mortageAccCompany.InterestAmount(1));


            var mortageAccIndividual = new MortageAccount(CustomerType.Individual, 105000.13m, 1.0m);

            Console.WriteLine("Customer: {0} | Balance: ${1:F2} | Interest Amount (1 Month): ${2:F2}",
                              mortageAccIndividual.Customer, mortageAccIndividual.Balance, mortageAccIndividual.InterestAmount(1));
        }
Exemple #4
0
        static void Main(string[] args)
        {
            LoanAccount loan = new LoanAccount(Customer.Individual, 500, 2);

            Console.WriteLine(loan.CalculateInterest(12));
            loan.Deposit(1000);
            Console.WriteLine(loan.Balance);
            Account deposit = new DepositAccount(Customer.Company, 100000, 8);

            Console.WriteLine(deposit.CalculateInterest(3));
        }
Exemple #5
0
        public static void Main(string[] args)
        {
            Customer ivanIvanov     = new IndividualCustomer("Ivan Ivanov");
            Customer petarStoyanov  = new IndividualCustomer("Petar Stoyanov");
            Customer annaVasileva   = new IndividualCustomer("Anna Vasileva");
            Customer mariaAtanasova = new IndividualCustomer("Maria Atanasova ");
            Customer cocaCola       = new CompanyCustomer("CocaCola");
            Customer microsoft      = new CompanyCustomer("Microsoft");
            Customer apple          = new CompanyCustomer("Apple");
            Customer google         = new CompanyCustomer("Google");

            DepositAccount depositIvanIvanov    = new DepositAccount(ivanIvanov, 800m, 0.05m);
            DepositAccount depositCocaCola      = new DepositAccount(cocaCola, 5000000m, 0.02m);
            LoanAccount    loanAnnaVasilev      = new LoanAccount(annaVasileva, -10000m, 0.12m);
            LoanAccount    loanGoogle           = new LoanAccount(google, -1000000m, 0.08m);
            MortageAccount mortagePetarStoyanov = new MortageAccount(petarStoyanov, -50000m, 0.07m);
            MortageAccount mortageMictosoft     = new MortageAccount(microsoft, -5000000m, 0.06m);

            IList <Account> accounts = new List <Account>();

            accounts.Add(depositIvanIvanov);
            accounts.Add(depositCocaCola);
            accounts.Add(loanAnnaVasilev);
            accounts.Add(loanGoogle);
            accounts.Add(mortagePetarStoyanov);
            accounts.Add(mortageMictosoft);

            foreach (var account in accounts)
            {
                Console.WriteLine(account);
            }

            depositIvanIvanov.WithDraw(258.15m);
            Console.WriteLine("\nInterest for next 4 mounts:");
            foreach (var account in accounts)
            {
                Console.WriteLine("{0} {1,14:F2}", account, account.InterestAmount(4));
            }

            depositIvanIvanov.Deposit(800m);
            loanAnnaVasilev.Deposit(600.12m);
            mortagePetarStoyanov.Deposit(1825.12m);
            Console.WriteLine("\nInterest for next 8 mounts:");
            foreach (var account in accounts)
            {
                Console.WriteLine("{0} {1,14:F2}", account, account.InterestAmount(8));
            }

            Console.WriteLine("\nInterest for next 20 mounts:");
            foreach (var account in accounts)
            {
                Console.WriteLine("{0} {1,14:F2}", account, account.InterestAmount(20));
            }
        }
        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();
        }
Exemple #7
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);
        }