Example #1
0
 static void Main()
 {
     //Create new deposit and test functionality
     Deposit testDeposit = new Deposit("Svetlin", "Nakov", CustomerType.Individual, 1500, 1);
     Console.WriteLine("----- Balance after creating account -----");
     Console.WriteLine(testDeposit.Balance); //Print 1500
     testDeposit.DepositMoney(100); // Add money in deposit
     Console.WriteLine("----- Balance after adding 100 -----");
     Console.WriteLine(testDeposit.Balance); //Print 1600
     testDeposit.WithdrawMoney(600); // Withdraw money from deposit
     Console.WriteLine("----- Balance after draw 600 -----");
     Console.WriteLine(testDeposit.Balance); //Print 1000
     Console.WriteLine("----- Interest amount -----");
     Console.WriteLine(testDeposit.InterestAmount(12)); //Calculate interest amount for 12 months with interest rate 1%, print 12
     testDeposit.WithdrawMoney(100); // Withdraw money from deposit
     testDeposit.InterestAmount(15); // Balance is 900 and doesn't have interest
 }
Example #2
0
        static void Main()
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

            //Try the restrictions for ID number and bulstat
            //Deposit newDeposit = new Deposit(new DateTime(2012, 05, 23), 1000m, 0.01m, new Individual("Ivan", "Peshev", "Stamatov", "0011r25144"));
            //Loan newLoan = new Loan(new DateTime(2012, 05, 23), 1000m, 0.01m, new Company("Google BG", "p44808111", "Pencho", "Kolev", "Vanchev"));

            //Create an array of accounts
            Account[] accounts = {
                                     new Deposit(new DateTime(2012,05,23), 1000m, 0.01m, new Individual("Ivan", "Peshev", "Stamatov", "0011225144")),
                                     new Deposit(new DateTime(2012,05,23), 900m, 0.01m, new Company("Google BG","144808111","Pencho","Kolev","Vanchev")),
                                     new Loan(new DateTime(2012,05,23), 1000m, 0.01m, new Individual("Pesho", "Peshev", "Rachev", "0011225144")),
                                     new Loan(new DateTime(2012,05,23), 1000m, 0.01m, new Company("Farmahim","081808192","Stamat","Kirev","Georgiev")),
                                     new Mortage(new DateTime(2012,05,23), 1000m, 0.01m, new Individual("Rosen", "Ivanov", "Krumov", "8212011414")),
                                     new Mortage(new DateTime(2012,05,23), 1000m, 0.01m, new Company("Laptop BG","343378192","Mitko","Rachkov","Popov"))
                                 };

            foreach (var account in accounts)
            {
                //Print customers info (ToString method check)
                Console.WriteLine(account);

                //Check the CalculateInterest method - calculate the interest till the present date
                Console.WriteLine("Interest till today: {0}\n", account.CalculateInterest(DateTime.Now));
            }

            //Create new deposit
            Deposit newDeposit = new Deposit(new DateTime(2012, 05, 23), 1000m, 0.01m, new Individual("Stamo", "Stamov", "Stamatov", "0011425144"));

            //Try the Withdraw method
            newDeposit.Withdraw(500);
            Console.WriteLine("{0}\n",newDeposit);

            //Try the Deposit method
            newDeposit.Deposit(100);
            Console.WriteLine(newDeposit);
        }