コード例 #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);
            }
        }