Пример #1
0
        static void Main()
        {
            //Create some customers
            List<Customer> customersList = new List<Customer> 
                                           {
                                            new Individual(1, "Ivan Ivanov", "Sofia", "888888888"),
                                            new Individual(2, "Petar Jotov", "Sofia", "777777777"),
                                            new Company(3, "Elit LTD", "Sofia", "555555555"),
                                            new Company(4, "Gama LTD", "Sofia", "222222222")
                                           };

            //Associate the customers with some accounts
            List<Account> accountsList = new List<Account> 
            {
                 new Deposit(customersList[0], new DateTime(2013, 1, 16), 2000),
                 new Deposit(customersList[0], new DateTime(2013, 2, 20), 500),
                 new Deposit(customersList[1], new DateTime(2013, 2, 1), 2000),
                 new Loan(customersList[2], new DateTime(2013, 1, 5), 2000),
                 new Loan(customersList[3], new DateTime(2012, 1, 5), 10000),
                 new Mortgage(customersList[2], new DateTime(2011, 10, 5), 70000),
            };

            //Calculate interest rates
            Console.WriteLine("Interest rates for all accounts report:");
            foreach (var account in accountsList)
            {
                Console.WriteLine("{0} interest amount is: {1:F2}", account.GetType().Name, account.CalculateInterestAmount());
            }

            //Add money to a deposit
            Console.WriteLine();
            Console.WriteLine("Example that adds money to a deposit account:");
            Deposit deposit1 = new Deposit(customersList[0], new DateTime(2013, 1, 16), 2000);
            Console.WriteLine("The deposit balance is: {0}", deposit1.Balance);
            deposit1.DepositMoney(300);
            Console.WriteLine("Deposit money were added to the account!");
            Console.WriteLine("The new deposit balance is: {0}", deposit1.Balance);
            Console.WriteLine();
            
            //Get the info for all accounts
            foreach (var account in accountsList)
            {
                Console.WriteLine(account.ToString());
                Console.WriteLine(new string('-', 50));
            }
        }
Пример #2
0
        static void Main()
        {
            //testing Deposit and with draw methods
            Deposit deposit1 = new Deposit("Pencho", Customer.Individual, 1200.00m, 6.80m, 36);
            Console.WriteLine(deposit1.ToString());
            deposit1.DepositMoney(900.00m);
            Console.WriteLine(deposit1.ToString());
            deposit1.WithDrawMoney(1800.00m);
            Console.WriteLine(deposit1.ToString());

            //creating an instance of all types account
            List<Account> bankAccounts = new List<Account>();
            bankAccounts.Add(new Deposit("Pencho", Customer.Individual, 800.00m, 6.80m, 12));
            bankAccounts.Add(new Deposit("Billa", Customer.Company, 12000.00m, 5.80m, 24));
            bankAccounts.Add(new Loan("Pitagor", Customer.Individual, 3000.00m, 5.80m, 48));
            bankAccounts.Add(new Loan("Demax", Customer.Company, 1000000.00m, 6.00m, 120));
            bankAccounts.Add(new Mortgage("Petrovi", Customer.Individual, 10000.00m, 6.78m, 120));
            bankAccounts.Add(new Mortgage("Nivea", Customer.Company, 100000.00m, 9.78m, 120));
            //Print input data
            foreach (var account in bankAccounts)
            {
                Console.WriteLine(account.GetType());
                Console.WriteLine("*************************");
                Console.WriteLine(account.ToString());
                Console.WriteLine("_________________________");
                Console.WriteLine();
            }
            //getInterest
            foreach (var account in bankAccounts)
            {
                Console.WriteLine(account.GetType());
                decimal interest = account.CalculateInterest(account.Client);
                Console.WriteLine("The interest of  {0}'s-account for {1} monts and interest rate {2} is {3} ",
                    account.CustomerID, account.PeriodInMonts, account.InterestRate,interest);
            }
        }
Пример #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     Deposit de = new Deposit();
     de.ShowDialog();
 }