Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Bank currentBank = new Bank("My Bank");

            DepositAccount depositAcc = new DepositAccount(new IndividualCustomer("pesho"), 3564.0m, 15);

            LoanAccount loanAcc = new LoanAccount(new CompanyCustomer("gosho inc."), 55678.54m, 22);

            MortgageAccount mortgageAcc = new MortgageAccount(new IndividualCustomer("tosho"), 21354.66m, 17);

            depositAcc.DepositMoney(150);
            depositAcc.WithdrawMoney(50);

            loanAcc.DepositMoney(200);

            mortgageAcc.DepositMoney(500);

            currentBank.AddAccount(depositAcc);
            currentBank.AddAccount(loanAcc);
            currentBank.AddAccount(mortgageAcc);

            //Console.WriteLine(currentBank);

            int numberOfMonths = 14;

            decimal calcInterest = depositAcc.CalculateInterest(numberOfMonths);

            Console.WriteLine(depositAcc + "calculated interest: {0:C3}", calcInterest);

            calcInterest = loanAcc.CalculateInterest(numberOfMonths);
            Console.WriteLine(loanAcc + "calculated interest: {0:C3}", calcInterest);

            calcInterest = mortgageAcc.CalculateInterest(numberOfMonths);
            Console.WriteLine(mortgageAcc + "calculated interest: {0:C3}", calcInterest);
        }
        static void Main(string[] args)
        {
            DepositAccount peshoAccount = new DepositAccount(new Customer(CustomerType.Individual, "Pesho Peshev"), 500M, 2.3M);
            DepositAccount killersAccount = new DepositAccount(new Customer(CustomerType.Company, "Killers"), 1500M, 2.3M);
            peshoAccount.Deposit(250M);
            killersAccount.Withdraw(250M);
            Console.WriteLine("DEPOSIT ACCOUNTS TEST");
            Console.WriteLine("Balance: {0:C}", peshoAccount.Balance);
            Console.WriteLine("Balance: {0:C}", killersAccount.Balance);
            Console.WriteLine("Interest: {0:F2} %", peshoAccount.CalculateInterestAmount(3));
            Console.WriteLine("Interest: {0:F2} %", killersAccount.CalculateInterestAmount(4));
            Console.WriteLine();

            LoanAccount goshoAccount = new LoanAccount(new Customer(CustomerType.Individual, "Gosho Goshev"), 300M, 2.3M);
            LoanAccount leadersAccount = new LoanAccount(new Customer(CustomerType.Company, "Leaders"), 3000M, 2.3M);
            goshoAccount.Deposit(250M);
            leadersAccount.Deposit(250M);
            Console.WriteLine("LOAN ACCOUNTS TEST");
            Console.WriteLine("Balance: {0:C}", goshoAccount.Balance);
            Console.WriteLine("Balance: {0:C}", leadersAccount.Balance);
            Console.WriteLine("Interest: {0:F2} %", goshoAccount.CalculateInterestAmount(4));
            Console.WriteLine("Interest: {0:F2} %", leadersAccount.CalculateInterestAmount(4));
            Console.WriteLine();

            MortgageAccount mimiAccount = new MortgageAccount(new Customer(CustomerType.Individual, "Maria Petrova"), 200M, 2.3M);
            MortgageAccount deadboysAccount = new MortgageAccount(new Customer(CustomerType.Company, "Dead Boys"), 23000M, 2.3M);
            mimiAccount.Deposit(250M);
            deadboysAccount.Deposit(250M);
            Console.WriteLine("MORTGAGE ACCOUNTS TEST");
            Console.WriteLine("Balance: {0:C}", mimiAccount.Balance);
            Console.WriteLine("Balance: {0:C}", deadboysAccount.Balance);
            Console.WriteLine("Interest: {0:F2} %", mimiAccount.CalculateInterestAmount(8));
            Console.WriteLine("Interest: {0:F2} %", deadboysAccount.CalculateInterestAmount(18));
            Console.WriteLine();
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Loan account: ");
            LoanAccount loanAcc = new LoanAccount(13.23m, 4.2m, Customer.personal, new DateTime(2013, 2, 1));

            Console.WriteLine(loanAcc.InterestOverMonths(2));
            Console.WriteLine(loanAcc.GetBalance);
            loanAcc.Deposit(4.54m);
            Console.WriteLine(loanAcc.GetBalance);

            Console.WriteLine("\n\nMortgage account: ");
            MortgageAccount mortAcc = new MortgageAccount(13.23m, 4.2m, Customer.personal, new DateTime(2013, 3, 5));

            Console.WriteLine(mortAcc.InterestOverMonths(8));
            Console.WriteLine(mortAcc.GetBalance);
            mortAcc.Deposit(55.3m);
            Console.WriteLine(mortAcc.GetBalance);

            Console.WriteLine("\n\nDeposit account: ");
            DepositAccount deposAcc = new DepositAccount(1200m, 3.2m, Customer.company, new DateTime(2012, 3, 5));

            Console.WriteLine(deposAcc.InterestOverMonths(5));
            Console.WriteLine(deposAcc.GetBalance);
            deposAcc.Deposit(200m);
            Console.WriteLine(deposAcc.GetBalance);
            deposAcc.WithdrawSum(55.35m);
            Console.WriteLine("Balance after withdrawal: {0}", deposAcc.GetBalance);
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            Console.WriteLine("Loan account: ");
            LoanAccount loanAcc = new LoanAccount(13.23m, 4.2m, Customer.personal, new DateTime(2013, 2, 1));
            Console.WriteLine(loanAcc.InterestOverMonths(2));
            Console.WriteLine(loanAcc.GetBalance);
            loanAcc.Deposit(4.54m);
            Console.WriteLine(loanAcc.GetBalance);

            Console.WriteLine("\n\nMortgage account: ");
            MortgageAccount mortAcc = new MortgageAccount(13.23m, 4.2m, Customer.personal, new DateTime(2013, 3, 5));
            Console.WriteLine(mortAcc.InterestOverMonths(8));
            Console.WriteLine(mortAcc.GetBalance);
            mortAcc.Deposit(55.3m);
            Console.WriteLine(mortAcc.GetBalance);

            Console.WriteLine("\n\nDeposit account: ");
            DepositAccount deposAcc = new DepositAccount(1200m, 3.2m, Customer.company, new DateTime(2012, 3, 5));
            Console.WriteLine(deposAcc.InterestOverMonths(5));
            Console.WriteLine(deposAcc.GetBalance);
            deposAcc.Deposit(200m);
            Console.WriteLine(deposAcc.GetBalance);
            deposAcc.WithdrawSum(55.35m);
            Console.WriteLine("Balance after withdrawal: {0}", deposAcc.GetBalance);
        }
Exemplo n.º 6
0
        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()
        {
            var depsoitTest = new DepositAccount(new Costumer("Wayne Rooney", AccountHolder.Individual), 200000, 0.25);

            var loanTestIndividual = new LoanAccount(new Costumer("Juan Mata", AccountHolder.Individual), 250000, 0.85);
            var loanTestCompany = new LoanAccount(new Costumer("Manchester Ltd", AccountHolder.Company), 250000, 0.85);

            var mortgageTestIndividual =  new MortgageAccount(new Costumer("Falcao", AccountHolder.Individual)
                , 750000, 0.75);
            var mortgageTestCompany = new MortgageAccount(new Costumer("United Ltd", AccountHolder.Company)
                , 750000, 0.75);

            depsoitTest.WithdrawMoney(199500); // less than 1000 = interest of 0
            Console.WriteLine(string.Format("{0} will receive interest of {1:C} for 12 months", depsoitTest.Holder.ToString(), depsoitTest.CalculateInterestAmount(12)));

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

            // 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(string.Format("{0} needs to pay interest of {1:C} for the next 12 months", loanTestIndividual.Holder.Name, loanTestIndividual.CalculateInterestAmount(12)));
            Console.WriteLine(string.Format("{0} needs to pay interest of  {1:C} for the next 12 months", loanTestCompany.Holder.Name, loanTestCompany.CalculateInterestAmount(12)));

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

            // Mortgage accounts have ½ interest for the first 12 months for companies
            // and no interest for the first 6 months for individuals.
            Console.WriteLine(string.Format("{0} needs to pay interest of {1:C} for the next 7 months", mortgageTestIndividual.Holder.Name, mortgageTestIndividual.CalculateInterestAmount(7)));
            Console.WriteLine(string.Format("{0} needs to pay interest of {1:C} for the next 7 months", mortgageTestCompany.Holder.Name, mortgageTestCompany.CalculateInterestAmount(7)));

            Console.WriteLine();
        }
Exemplo n.º 8
0
 public static void Main()
 {
     IndividualCustomer me = new IndividualCustomer("Vanya Karaasenova", "12555555");
     DepositAccount myDepositAccount = new DepositAccount(me);
     Console.WriteLine("My deposit account interest rate: {0}", myDepositAccount.InterestRate);
     myDepositAccount.DepositMoney(50000);
     Console.WriteLine("My deposit account balance: {0}", myDepositAccount.Balance);
     decimal result = myDepositAccount.CalculateMonthlyInterest();
     Console.WriteLine("My deposit account monthly interest: {0}", result);
 }
Exemplo n.º 9
0
        static void Main()
        {
            Company microsoft = new Company("Microsoft");
            Individual gosho = new Individual("Gosho");

            DepositAccount depositTest = new DepositAccount(microsoft, 100000, 15);
            MortgageAccount mortgageTest = new MortgageAccount(gosho, 400, 20);

            Console.WriteLine("Customer type:{0}\nCustomer name: {1}",gosho.ToString(),gosho.Name);
            Console.WriteLine("Initial mortgage account balance:{0}lv",mortgageTest.Balance);
            mortgageTest.DepositAmount(30);
            Console.WriteLine("Account balance after adding 30 lv:{0}lv\n",mortgageTest.Balance);

            Console.WriteLine("Customer type:{0}\nCustomer name: {1}",microsoft.ToString(), microsoft.Name);
            Console.WriteLine("Initial deposit account balance:{0}lv",depositTest.Balance);
            depositTest.WithdrawAmount(30000);
            Console.WriteLine("Account balance after withdrawing 30000lv:{0}lv", depositTest.Balance);
            Console.WriteLine("Account interest amount for twelve months:{0}lv\n", depositTest.CalcInterestAmount(12));
        }
        static void Main()
        {
            Account[] accounts =
            {
                new DepositAccount(new Individual("Ivan"),5.2m,1030.6m),
                new LoanAccount(new Company("ABC"),2.3m,50000000.6m),
                new MortgageAccount(new Individual("Pesho"),6,8000)
            };

            foreach (var a in accounts)
            {
                Console.WriteLine(a.ToString());
                Console.WriteLine("The interest for 5 months paid in the {0} is {1:F2} ",
                    a.GetType().Name, a.CalcInterest(5));
            }
            Console.WriteLine();
            DepositAccount acc = new DepositAccount(new Individual("Ivan"), 5, 500);
            acc.Withdraw(100);
            Console.WriteLine("The balance of {0}'s account after withdrawal of 100 lv is:{1}", acc.Owner.Name, acc.Balance);
        }
        static void Main(string[] args)
        {
            DepositAccount peshoAccount   = new DepositAccount(new Customer(CustomerType.Individual, "Pesho Peshev"), 500M, 2.3M);
            DepositAccount killersAccount = new DepositAccount(new Customer(CustomerType.Company, "Killers"), 1500M, 2.3M);

            peshoAccount.Deposit(250M);
            killersAccount.Withdraw(250M);
            Console.WriteLine("DEPOSIT ACCOUNTS TEST");
            Console.WriteLine("Balance: {0:C}", peshoAccount.Balance);
            Console.WriteLine("Balance: {0:C}", killersAccount.Balance);
            Console.WriteLine("Interest: {0:F2} %", peshoAccount.CalculateInterestAmount(3));
            Console.WriteLine("Interest: {0:F2} %", killersAccount.CalculateInterestAmount(4));
            Console.WriteLine();

            LoanAccount goshoAccount   = new LoanAccount(new Customer(CustomerType.Individual, "Gosho Goshev"), 300M, 2.3M);
            LoanAccount leadersAccount = new LoanAccount(new Customer(CustomerType.Company, "Leaders"), 3000M, 2.3M);

            goshoAccount.Deposit(250M);
            leadersAccount.Deposit(250M);
            Console.WriteLine("LOAN ACCOUNTS TEST");
            Console.WriteLine("Balance: {0:C}", goshoAccount.Balance);
            Console.WriteLine("Balance: {0:C}", leadersAccount.Balance);
            Console.WriteLine("Interest: {0:F2} %", goshoAccount.CalculateInterestAmount(4));
            Console.WriteLine("Interest: {0:F2} %", leadersAccount.CalculateInterestAmount(4));
            Console.WriteLine();

            MortgageAccount mimiAccount     = new MortgageAccount(new Customer(CustomerType.Individual, "Maria Petrova"), 200M, 2.3M);
            MortgageAccount deadboysAccount = new MortgageAccount(new Customer(CustomerType.Company, "Dead Boys"), 23000M, 2.3M);

            mimiAccount.Deposit(250M);
            deadboysAccount.Deposit(250M);
            Console.WriteLine("MORTGAGE ACCOUNTS TEST");
            Console.WriteLine("Balance: {0:C}", mimiAccount.Balance);
            Console.WriteLine("Balance: {0:C}", deadboysAccount.Balance);
            Console.WriteLine("Interest: {0:F2} %", mimiAccount.CalculateInterestAmount(8));
            Console.WriteLine("Interest: {0:F2} %", deadboysAccount.CalculateInterestAmount(18));
            Console.WriteLine();
        }
Exemplo n.º 12
0
        static void Main()
        {
            CompanyCustomer aries         = new CompanyCustomer("Aries", "Sofia");
            List <Account>  ariesAccounts = new List <Account>()
            {
                new DepositAccount(aries, 15000, 0.3M),
                new LoanAccount(aries, 12000, 0.01M),
                new MortgageAccount(aries, 10000, 0.02M)
            };

            ariesAccounts[0].Deposit(1000);
            Console.WriteLine("Ballance of the Aries' deposit account: {0}", ariesAccounts[0].Balance);
            Console.WriteLine("Ballance of the Aries' accounts:\r\nDeposit: {0}\r\nLoan: {1}\r\nMortgage: {0}", ariesAccounts[0].Balance, ariesAccounts[1].Balance, ariesAccounts[2].Balance);

            Console.WriteLine();

            IndividualCustomer gosho        = new IndividualCustomer("Georgi", "Georgiev", "Varna");
            DepositAccount     goshoDeposit = new DepositAccount(gosho, 2000, 0.03M);

            goshoDeposit.Draw(500);
            Console.WriteLine("Ballance of Georgi Georgiev's deposit account: {0}", goshoDeposit.Balance);
            Console.WriteLine("The interest of Georgi Georgiev's deposit account for the first 3 months: {0}", goshoDeposit.CalculateInterestAmount(3));
        }
Exemplo n.º 13
0
        static void Main()
        {
            CompanyCustomer aries = new CompanyCustomer("Aries", "Sofia");
            List<Account> ariesAccounts = new List<Account>()
            {
                new DepositAccount(aries, 15000, 0.3M),
                new LoanAccount (aries, 12000, 0.01M),
                new MortgageAccount (aries, 10000, 0.02M)
            };

            ariesAccounts[0].Deposit(1000);
            Console.WriteLine("Ballance of the Aries' deposit account: {0}", ariesAccounts[0].Balance);
            Console.WriteLine("Ballance of the Aries' accounts:\r\nDeposit: {0}\r\nLoan: {1}\r\nMortgage: {0}", ariesAccounts[0].Balance, ariesAccounts[1].Balance, ariesAccounts[2].Balance);

            Console.WriteLine();

            IndividualCustomer gosho = new IndividualCustomer("Georgi", "Georgiev", "Varna");
            DepositAccount goshoDeposit = new DepositAccount(gosho, 2000, 0.03M);

            goshoDeposit.Draw(500);
            Console.WriteLine("Ballance of Georgi Georgiev's deposit account: {0}", goshoDeposit.Balance);
            Console.WriteLine("The interest of Georgi Georgiev's deposit account for the first 3 months: {0}", goshoDeposit.CalculateInterestAmount(3));
        }
Exemplo n.º 14
0
        static void Main()
        {
            var depositAcc = new DepositAccount(new Customer("Ivan Que", CustomerType.Individual), 100, 3.6M, new DateTime(2014, 01, 15));

            var loanAcc = new LoanAccount(new Customer("Peter P", CustomerType.Company), 1000M, 4.3M, new DateTime(2013, 07, 26));

            var mortgageAcc = new Mortgage(new Customer("Maria Deneris", CustomerType.Individual), 15000M, 7.5M, new DateTime(2012, 02, 16));

            //deposit acc test
            Console.WriteLine("Deposit account:");
            Console.WriteLine("Balance before deposit = " + depositAcc.Balance);
            depositAcc.Deposit = 1000M;
            Console.WriteLine("Balance after deposit = " + depositAcc.Balance);

            Console.WriteLine("Balance before withdraw = " + depositAcc.Balance);
            depositAcc.WitdrawAmount = 500M;
            Console.WriteLine("Balance after withdraw = " + depositAcc.Balance);

            Console.WriteLine("Calculate interest rate for 9 months = " + depositAcc.CalculateInterestAmount(9));

            // loan test
            Console.WriteLine("\r\nLoan account:");
            Console.WriteLine("Balance before deposit = " + loanAcc.Balance);
            loanAcc.Deposit = 330M;
            Console.WriteLine("Balance after deposit = " + loanAcc.Balance);

            Console.WriteLine("Calculate interest rate for 9 months = " + loanAcc.CalculateInterestAmount(6));

            // mortgage test
            Console.WriteLine("\r\nMortgage account:");
            Console.WriteLine("Balance before deposit = " + mortgageAcc.Balance);
            mortgageAcc.Deposit = 8033M;
            Console.WriteLine("Balance after deposit = " + mortgageAcc.Balance);

            Console.WriteLine("Calculate interest rate for 9 months = " + mortgageAcc.CalculateInterestAmount(10));
        }