Ejemplo n.º 1
0
 static void Main(string[] args)
 {
     Accounts loan = new Loan(7000, new Companies("Nike"), 0.09);
     loan.Deposit(600);
     Accounts deposit = new DepositAccount(1500, new IndividualCustomer("Gosho"), 0.12);
     deposit.Deposit(200);
     Accounts mortgage = new Mortgage(5000, new Companies("Puma"), 0.12);
     mortgage.Deposit(6000);
     Console.WriteLine(loan.CalculateRate(3));
     Console.WriteLine(mortgage.CalculateRate(15));
     Console.WriteLine(deposit.CalculateRate(10));
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Deposit x = new Deposit(new Customer("gosho", "goshev", Customer.AccountType.Individual), 1550, 0.01m);
            Mortage b = new Mortage(new Customer("Az", "Toi", Customer.AccountType.Company), 1000, 0.05m);
            Loan l = new Loan(new Customer("Tereza", "Maria", Customer.AccountType.Individual), 5000,0.1m );

            b.DepositMoney(555);
            x.Widthdraw(1000);

            Console.WriteLine(x.CalcInterestRate(x.Balance,25));
            Console.WriteLine(b.CalcInterestRate(b.Balance,25));
            Console.WriteLine(l.CalcInterestRate(l.Balance,36));
        }
        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);
            }
        }