Exemplo n.º 1
0
        static void Main()
        {
            DepositAcc deposit = new DepositAcc(new Customer("Ivan"), 999, 2.3m);
            LoanAcc loan = new LoanAcc(new Customer("Pesho"), 1200, 2.3m);
            MortgageAcc mortgage = new MortgageAcc(new Customer("Telerik", TypeCustomer.Company), 1200000, 2.3m);

            Console.WriteLine("Deposit intrest for 12 months = " + deposit.CalculateIntrest(12));
            Console.WriteLine("Loan intrest for 12 months = " + loan.CalculateIntrest(12));
            Console.WriteLine("Mortgage intrest for 12 months = " + mortgage.CalculateIntrest(12));

            Console.WriteLine(deposit.GetBalance());
            deposit.DepositMoney(101);
            deposit.WithdrawMonew(10);
            Console.WriteLine(deposit.GetBalance());

            Console.WriteLine(deposit.GetCustomerInfo());
            Console.WriteLine(loan.CalculateIntrest(4));
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Bank b = new Bank();
            Customer pesho = new Individual("Pesho");
            Customer telerik = new Company("Telerik");
            Customer gosho = new Individual("Gosho");
            Customer remax = new Company("Re/Max");
            b.Customers = new List<Customer>
            {
               pesho,
               telerik,
               gosho,
               remax
            };

            Account peshoAcc = new DepositAcc(pesho, 100, 3);
            Account telerikAcc = new MortgageAcc(telerik, 80000, 6);
            Account goshoAcc = new MortgageAcc(gosho, 450, 3);
            Account remaxAcc = new LoanAcc(remax, 90000, 7);
            b.Accounts = new List<Account>
            {
               peshoAcc,
               telerikAcc,
               goshoAcc,
               remaxAcc
            };

            //pesho operating
            Console.WriteLine("Pesho has {0} before deposit.",peshoAcc.Balance);

            peshoAcc.Deposit(50);
            Console.WriteLine("Now Pesho has {0} in his account",peshoAcc.Balance);

            (peshoAcc as DepositAcc).WithDraw(150);
            Console.WriteLine(peshoAcc.Balance);

            //calculating interest
            Console.WriteLine(peshoAcc.CalcInterest(7));

            Console.WriteLine(telerikAcc.CalcInterest(60));

            Console.WriteLine(goshoAcc.CalcInterest(50));
        }