Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Accounts deposit                  = new DepositAccount(new IndividualCustomer("Ivan Ivanov"), 1250, 2);
            Accounts loanCompanyAccount       = new LoanAccount(new CompaniesCustomer("Telerik Academy"), 10000, 5);
            Accounts loanIndividualAccount    = new LoanAccount(new IndividualCustomer("Pesho Petkov"), 2500, 3);
            Accounts mortageCompanyAccount    = new MortgageAccount(new CompaniesCustomer("Opel"), 15000000, 10);
            Accounts mortageIndividualAccount = new MortgageAccount(new IndividualCustomer("Stamat Stamatov"), 500, 3);


            Console.WriteLine($"{deposit.GetType().Name} have interest amount: {deposit.CalculateInterestAmount(2)}");
            Console.WriteLine($"{loanCompanyAccount.GetType().Name} have interest amount: {loanCompanyAccount.CalculateInterestAmount(3)}");
            Console.WriteLine($"{loanIndividualAccount.GetType().Name} have interest amount: {loanIndividualAccount.CalculateInterestAmount(8)}");
            Console.WriteLine($"{mortageCompanyAccount.GetType().Name} have interest amount: {mortageCompanyAccount.CalculateInterestAmount(10)}");
            Console.WriteLine($"{mortageIndividualAccount.GetType().Name} have interest amount: {mortageIndividualAccount.CalculateInterestAmount(7)}");
        }
        static void Main(string[] args)
        {
            IndividualCustomer pesho = new IndividualCustomer("Pesho");
            CompanyCustomer telerik = new CompanyCustomer("Telerik");

            LoanAccounts loanAcc = new LoanAccounts(pesho, 250, 25);
            DepositAccount depositAcc = new DepositAccount(telerik, 10000, 20);

            Console.WriteLine(loanAcc.Balance);
            loanAcc.DepositMoney(200);
            Console.WriteLine(loanAcc.Balance);
            depositAcc.DrawMoney(3300);
            Console.WriteLine(depositAcc.Balance);
            Console.WriteLine(loanAcc.InterestAmount(3));
            Console.WriteLine(loanAcc.InterestAmount(7));
        }