コード例 #1
0
        static void Main()
        {
            var pesho      = new IndividualCustomer("Pesho");
            var goshoOOD   = new BusinessCustomer("GoshoOOD");
            var petrana    = new BusinessCustomer("PetranaEOOD");
            var depositAcc = new Deposit(pesho, 5000, 6);

            Console.WriteLine("Pesho`s balance : {0}", depositAcc.Balance);
            depositAcc.DepositAmount(6000);
            Console.WriteLine("Pesho`s balance after deposit: {0}", depositAcc.Balance);
            Console.WriteLine("Pesho`s interest for 6 months: {0} %", depositAcc.CalculateInterest(6));
            depositAcc.WithDrawAmount(10900);
            Console.WriteLine("Pesho`s balance after withdraw : {0}", depositAcc.Balance);

            var mortgage = new Mortgage(goshoOOD, 15000, 4);

            Console.WriteLine("Gosho`s mortgage balance: {0}", mortgage.Balance);
            mortgage.DepositAmount(32500);
            Console.WriteLine("Gosho`s mortgage balance after deposit: {0} ", mortgage.Balance);
            Console.WriteLine("Gosho`s mortgage interest : {0} %", mortgage.CalculateInterest(12));

            var loanAcc = new Loan(petrana, 73000, 2);

            Console.WriteLine("Petrana`s balance : {0}", loanAcc.Balance);
            Console.WriteLine("Petrana`s interest for 16 months : {0} %", loanAcc.CalculateInterest(16));
            loanAcc.DepositAmount(50000);
            Console.WriteLine("Petrana`s balance after deposit : {0}", loanAcc.Balance);
        }
コード例 #2
0
        static void Main()
        {
            Customer Bob = new Individual("Bob", "Sideshow");
            Customer Iron = new Company("Iron", "Ltd.");

            Account depo = new Deposit("bob", 1200.00m);
            depo.NewCustomer = Bob;
            depo.DepositMoney(100.50m);
            depo.Withdraw(50.10m);
            Console.WriteLine(  depo.CalculateInterest(3.5m, 24, Bob) );

            Account lo = new Loan("Iron Ltd.", 3210000.123m);
            lo.NewCustomer = Iron;
            lo.DepositMoney(2000.001m);
            lo.Withdraw(20111.1m);
            Console.WriteLine( lo.CalculateInterest(9.10m, 52, Iron) );
        }
コード例 #3
0
        static void Main()
        {
            Customer Bob  = new Individual("Bob", "Sideshow");
            Customer Iron = new Company("Iron", "Ltd.");

            Account depo = new Deposit("bob", 1200.00m);

            depo.NewCustomer = Bob;
            depo.DepositMoney(100.50m);
            depo.Withdraw(50.10m);
            Console.WriteLine(depo.CalculateInterest(3.5m, 24, Bob));

            Account lo = new Loan("Iron Ltd.", 3210000.123m);

            lo.NewCustomer = Iron;
            lo.DepositMoney(2000.001m);
            lo.Withdraw(20111.1m);
            Console.WriteLine(lo.CalculateInterest(9.10m, 52, Iron));
        }