Beispiel #1
0
        static void Main(string[] args)
        {
            Deposit deposit = new Deposit(Customer.Companie, 22000m, 7.9m);

            deposit.WithdrawMoney(2200m);
            deposit.CalculateInterest(10);
            deposit.DepositMoney(5000m);
            Console.WriteLine("Deposit\n{0}", deposit);

            Loan loanCompanie = new Loan(Customer.Companie, 65000m, 9.6m);

            loanCompanie.DepositMoney(35000m);
            loanCompanie.CalculateInterest(22);
            Console.WriteLine("Loan Companie\n{0}", loanCompanie);

            Loan loanIndividual = new Loan(Customer.Individual, 5500m, 1.6m);

            loanCompanie.DepositMoney(5000m);
            loanCompanie.CalculateInterest(12);
            Console.WriteLine("Loan Individual\n{0}", loanIndividual);

            Mortgage mortgageCompanie = new Mortgage(Customer.Companie, 1200m, 3.2m);

            mortgageCompanie.DepositMoney(452m);
            mortgageCompanie.CalculateInterest(5);
            Console.WriteLine("Mortgage Companie\n{0}", mortgageCompanie);

            Mortgage mortgageIndividual = new Mortgage(Customer.Individual, 5600m, 0.2m);

            mortgageIndividual.DepositMoney(5632m);
            mortgageIndividual.CalculateInterest(10);
            Console.WriteLine("Mortgage Individual\n{0}", mortgageIndividual);
        }
        static void Main(string[] args)
        {
            try
            {
                Deposit depositCompany = new Deposit(Customer.Company, 15000, 5);
                depositCompany.Withdraw(300);
                depositCompany.DepositMoney(100);
                depositCompany.CalculateInterest(15);
                Console.WriteLine("Deposit company:\n{0}", depositCompany);

                Deposit depositIndividual = new Deposit(Customer.Individual, 20000, 15);
                depositIndividual.Withdraw(700);
                depositIndividual.DepositMoney(560);
                depositIndividual.CalculateInterest(4);
                Console.WriteLine("Deposit individual:\n{0}", depositIndividual);

                Loan loanIndividual = new Loan(Customer.Individual, 10045, 45);
                loanIndividual.DepositMoney(5699);
                loanIndividual.CalculateInterest(15);
                Console.WriteLine("Loan individual:\n{0}", loanIndividual);

                Loan loanCompany = new Loan(Customer.Company, 256666, 9);
                loanCompany.DepositMoney(3000);
                loanCompany.CalculateInterest(6);
                Console.WriteLine("Loan company:\n{0}", loanCompany);

                Mortgage mortageIndividual = new Mortgage(Customer.Individual, 500, 5);
                mortageIndividual.DepositMoney(200.89);
                mortageIndividual.CalculateInterest(5);
                Console.WriteLine("Mortage individual:\n{0}", mortageIndividual);

                Mortgage mortageCompany = new Mortgage(Customer.Company, 650.45, 11);
                mortageCompany.DepositMoney(2000);
                mortageCompany.CalculateInterest(14);
                Console.WriteLine("Mortage company:\n{0}", mortageCompany);
            }
            catch (OverflowException ex)
            {
                Console.WriteLine(ex.Message);
            }
            catch (ArgumentOutOfRangeException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Beispiel #3
0
        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);

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

                Mortgage mortageCompany = new Mortgage(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);
            }
        }