예제 #1
0
        public static void Main()
        {
            Console.Title = "Problem 2.	Bank of Kurtovo Konare";

            Deposit goshoDeposit = new Deposit(Customer.Individuals, 1000m, 0.05m);
            goshoDeposit.DepositMoney(450);
            goshoDeposit.WithdrawMoney(400);
            Console.WriteLine(goshoDeposit + "Interest = " + goshoDeposit.CalculateInterest(10));
            Console.WriteLine();

            Loan carskiZaem = new Loan(Customer.Companies, 50000m, 0.1m);
            carskiZaem.DepositMoney(1);
            Console.WriteLine(carskiZaem + "Interest = " + carskiZaem.CalculateInterest(5));
            Console.WriteLine();

            Mortgage bmwPesho = new Mortgage(Customer.Individuals, 10000m, 0.01m);
            bmwPesho.DepositMoney(5000);
            Console.WriteLine(bmwPesho + "Interest = " + bmwPesho.CalculateInterest(30));
        }
예제 #2
0
파일: Test.cs 프로젝트: f0rward0/Csharp
        static void Main(string[] args)
        {
            try
            {
                Deposit deposit = new Deposit(Customer.Company, 20000m, 3.4m);
                deposit.Withdraw(345m);
                deposit.DepositMoney(1000m);
                deposit.CalculateInterest(10);
                Console.WriteLine("Deposit:\n{0}", deposit);

                Loan loanIndividual = new Loan(Customer.Individual, 1000m, 20m);
                loanIndividual.DepositMoney(3000m);
                loanIndividual.CalculateInterest(5);
                Console.WriteLine("Loan individual:\n{0}", loanIndividual);

                Loan loanCompalny = new Loan(Customer.Company, 200000m, 5m);
                loanCompalny.DepositMoney(30000m);
                loanCompalny.CalculateInterest(4);
                Console.WriteLine("Loan company:\n{0}", loanCompalny);

                Mortage mortageIndividual = new Mortage(Customer.Individual, 500, 3.3m);
                mortageIndividual.DepositMoney(200m);
                mortageIndividual.CalculateInterest(7);
                Console.WriteLine("Mortage individual:\n{0}", mortageIndividual);

                Mortage mortageCompany = new Mortage(Customer.Company, 50000, 4m);
                mortageIndividual.DepositMoney(2000m);
                mortageIndividual.CalculateInterest(13);
                Console.WriteLine("Mortage individual:\n{0}", mortageIndividual);
            }
            catch (OverflowException ex)
            {
                Console.WriteLine(ex.Message);
            }
            catch (ArgumentOutOfRangeException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }