CalculateInterest() public method

public CalculateInterest ( int monthsCount ) : decimal
monthsCount int
return decimal
コード例 #1
1
ファイル: TEST.cs プロジェクト: nzhul/TelerikAcademy
        static void Main()
        {
            DepositAccount myDeposit = new DepositAccount(Customer.Individual, 0, 1);
            myDeposit.Deposit(2500);

            Console.WriteLine("Balance: {0}", myDeposit.Balance);
            Console.WriteLine("Interest: {0}", myDeposit.CalculateInterest(12));

            Console.WriteLine("... Withdrawing $2000 ...");
            myDeposit.Withdraw(-2000);
            // myDeposit.Withdraw(-2800); - this will throw exeption

            Console.WriteLine("New Balance {0}", myDeposit.Balance);
            Console.WriteLine("new Interest: {0}", myDeposit.CalculateInterest(12));
        }
コード例 #2
0
        static void Main()
        {
            DepositAccount myDeposit = new DepositAccount(Customer.Individual, 0, 1);

            myDeposit.Deposit(2500);

            Console.WriteLine("Balance: {0}", myDeposit.Balance);
            Console.WriteLine("Interest: {0}", myDeposit.CalculateInterest(12));

            Console.WriteLine("... Withdrawing $2000 ...");
            myDeposit.Withdraw(-2000);
            // myDeposit.Withdraw(-2800); - this will throw exeption

            Console.WriteLine("New Balance {0}", myDeposit.Balance);
            Console.WriteLine("new Interest: {0}", myDeposit.CalculateInterest(12));
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Customers      mycustomer = new Customers("Peter", CustomerType.individuals);
            DepositAccount mydeposit  = new DepositAccount(mycustomer, 4000, 2.5m, new DateTime(2019, 01, 23));

            Console.WriteLine(mydeposit.MakeWithdrawal(500m));
            Console.WriteLine(mydeposit.CalculateInterest());
            //Console.WriteLine(DateTime.Now.Month);
            Console.ReadKey();
        }
コード例 #4
0
        static void Main()
        {
            DepositAccount depositPersonAcc = new DepositAccount(Customer.Individual, 10000.00M, 2.5);

            Console.WriteLine("Individual deposit account(balance = {0}) interest for 12 months = {1:F2}."
                              , depositPersonAcc.Balance, depositPersonAcc.CalculateInterest(12));
            Console.WriteLine("Withdrawing from this account 9500.");
            depositPersonAcc.Withdraw(9500);
            Console.WriteLine("Individual deposit account(balance = {0}) interest for 12 months = {1:F2}."
                              , depositPersonAcc.Balance, depositPersonAcc.CalculateInterest(12));
            Console.WriteLine("Try to withdraw 501.");
            depositPersonAcc.Withdraw(501);

            LoanAccount loanPersonAcc  = new LoanAccount(Customer.Individual, -15250.35M, 2.0);
            LoanAccount loanCompanyAcc = new LoanAccount(Customer.Company, -50000, 1.5);

            Console.WriteLine("\nIndividual loan account(balance = {0}) interest for 3 months = {1:F2}."
                              , loanPersonAcc.Balance, loanPersonAcc.CalculateInterest(3));
            Console.WriteLine("Individual loan account(balance = {0}) interest for 10 months = {1:F2}."
                              , loanPersonAcc.Balance, loanPersonAcc.CalculateInterest(10));
            Console.WriteLine("Company loan account(balance = {0}) interest for 10 months = {1:F2}."
                              , loanCompanyAcc.Balance, loanCompanyAcc.CalculateInterest(10));
            Console.WriteLine("Company loan account(balance = {0}) interest for 2 months = {1:F2}."
                              , loanCompanyAcc.Balance, loanCompanyAcc.CalculateInterest(2));

            MortgageAccount mortgagePersonAcc  = new MortgageAccount(Customer.Individual, -2500.50M, 3.2);
            MortgageAccount mortgageCompanyAcc = new MortgageAccount(Customer.Company, -1000M, 1);

            Console.WriteLine("\nIndividual mortgage account(balance = {0}) interest for 6 months = {1:F2}."
                              , mortgagePersonAcc.Balance, mortgagePersonAcc.CalculateInterest(6));
            Console.WriteLine("Individual mortgage account(balance = {0}) interest for 10 months = {1:F2}."
                              , mortgagePersonAcc.Balance, mortgagePersonAcc.CalculateInterest(10));
            Console.WriteLine("Individual mortgage account(balance = {0}) interest for 12 months = {1:F2}."
                              , mortgageCompanyAcc.Balance, mortgageCompanyAcc.CalculateInterest(12)); //for first 12 months interest is 60$
            Console.WriteLine("Individual mortgage account(balance = {0}) interest for 24 months = {1:F2}."
                              , mortgageCompanyAcc.Balance, mortgageCompanyAcc.CalculateInterest(24)); //for 24 months interest is 60$ for first 12months + 120$ for next 12 months
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: robertmri/week05tema2
        static void Main(string[] args)
        {
            var b = new Bank("ING");

            var c1 = new Individual();

            var d = new DepositAccount(b, c1, 1000, 3.85m, 12);

            Console.WriteLine(d.CalculateInterest());


            var l = new LoanAccount(b, c1, 1000, 3.5m, 12);

            Console.WriteLine(l.CalculateInterest());

            var c2 = new Company();
            var m  = new MortgageAccount(b, c2, 1500, 3.8m, 36);

            Console.WriteLine(m.CalculateInterest());
        }
コード例 #6
0
ファイル: MainClass.cs プロジェクト: ImarKelam/OOP
        public static void Main()
        {
            DepositAccount kiro = new DepositAccount(Customers.Individual, 1000m, 5);
            Console.WriteLine(kiro.CalculateInterest(10) + "\n");

            LoanAccount pesho = new LoanAccount(Customers.Individual, 1500m, 3);
            Console.WriteLine(pesho.CalculateInterest(12) + "\n");

            LoanAccount maglaOOD = new LoanAccount(Customers.Company, 1500m, 3);
            Console.WriteLine(maglaOOD.CalculateInterest(12) + "\n");

            MortgageAccount penka = new MortgageAccount(Customers.Individual, 50000m, 2);
            Console.WriteLine(penka.CalculateInterest(8) + "\n");

            MortgageAccount shadyAD = new MortgageAccount(Customers.Company, 250000m, 5);
            Console.WriteLine(penka.CalculateInterest(12) + "\n");

            MortgageAccount shadyOOD = new MortgageAccount(Customers.Company, 250000m, 5);
            Console.WriteLine(penka.CalculateInterest(24) + "\n");
        }