コード例 #1
0
        static void Main()
        {
            try
            {
                Accounts companyDeposit = new Deposit(Customer.Company, 1400m, 0.87m);
                companyDeposit.DepositMoney(800m);
                companyDeposit.WithdrawMoney(568m);
                Console.WriteLine(companyDeposit.GetInterestAmount(50));
                companyDeposit.WithdrawMoney(25000000m);
            }
            catch (ArgumentException exc)
            {
                Console.WriteLine(exc.Message);
            }
            Console.WriteLine("....");

            try
            {
                Accounts personalMortgage = new Mortgage(Customer.Individual, 800032m, 0.43m);
                Console.WriteLine(personalMortgage.GetInterestAmount(200));

            }
            catch (ArgumentException exc)
            {
                Console.WriteLine(exc.Message);
            }
        }
コード例 #2
0
        static void Main()
        {
            try
            {
                Account companyDeposit = new Deposit(CustomerType.Company, 1000m, 0.67m);
                companyDeposit.DepositMoney(10000m);
                companyDeposit.WithdrawMoney(7578m);
                Console.WriteLine(companyDeposit.GetInterestAmount(48));
                companyDeposit.WithdrawMoney(20000000m);
            }
            catch (ArgumentException exc)
            {
                Console.WriteLine(exc.Message);
            }

            Console.WriteLine("--------------------");

            try
            {
                Account individualsMortage = new Mortage(CustomerType.Individual, 780000m, 0.47m);
                Console.WriteLine(individualsMortage.GetInterestAmount(240));
            }
            catch (ArgumentException exc)
            {
                Console.WriteLine(exc.Message);
            }
        }
コード例 #3
0
        static void Main()
        {
            try
            {
                Account companyDeposit = new Deposit(CustomerType.Company, 1000m, 0.67m);
                companyDeposit.DepositMoney(10000m);
                companyDeposit.WithdrawMoney(7578m);
                Console.WriteLine(companyDeposit.GetInterestAmount(48));
                companyDeposit.WithdrawMoney(20000000m);
            }
            catch (ArgumentException exc)
            {
                Console.WriteLine(exc.Message);
            }

                Console.WriteLine("--------------------");

            try
            {
                Account individualsMortage = new Mortage(CustomerType.Individual, 780000m, 0.47m);
                Console.WriteLine(individualsMortage.GetInterestAmount(240));

            }
            catch (ArgumentException exc)
            {
                Console.WriteLine(exc.Message);
            }
        }
コード例 #4
0
        static void Main()
        {
            Console.WriteLine("Before using deposit and withdraw: ");

            Bank PostBank = new Bank("Post Bank");

            Deposit PSB = new Deposit(new Company("PSB"), 1200, 0.5M);

            PostBank.AddAccount(PSB);
            PostBank.AddAccount(new Deposit(new Individuals("Fouk Moralez"), 200, 0.7M));
            PSB.WithdrawMoney(500);

            Mortgage PacksIT = new Mortgage(new Company("PacksIT"), 50000, 0.7M);

            PostBank.AddAccount(PacksIT);
            PostBank.AddAccount(new Mortgage(new Individuals("Anjelica Jhones"), 5000, 0.2M));
            PacksIT.DepositMoney(120);

            PostBank.AddAccount(new Loan(new Company("underground"), 120000005, 0.1M));
            PostBank.AddAccount(new Loan(new Individuals("Frank Perez"), 125, 0.7M));

            Console.WriteLine(PostBank.ToString());
            Console.WriteLine("PSB Calculating Interest: " + PSB.CalculateInterest(24));

            Console.WriteLine("After using deposit and withdraw: ");
            Console.WriteLine();
            Console.WriteLine(PostBank.ToString());
        }