Code Format Change

Just a quick update to let everyone know who visits my blog thanks in advance. I know updated are sporadic from time to time. So any comments or suggestions please let me know. They are noticed.

Also I’m sure you’ve seen on the last few posts that the code is being displayed differently. This is being done moving forward now do that all of the code can be displayed. I’ve noticed in some past posts  that not all of the code is being displayed if it runs too far to the right of the window. I’ll be going back and editing past posts also over time. So keep a lookout for those changes. So, again, moving forward I’ll start displaying it this way:

Code Example:

private double calculatePayment(double interestRate, double loanAmount, int numberOfMonthlyPayments)
    {
        //Making sure we have valid data.
        if (interestRate > 0 && loanAmount > 0 && numberOfMonthlyPayments > 0)
        {
            //Checking the interest rate format, and divide into monthly percentage rate accordingly.
            if (interestRate > 0)
                interestRate /= 1200;
            else
                interestRate /= 12;

            //Calculate and return the loan payment amount.
            return (interestRate + (interestRate / (Math.Pow(1 + interestRate, numberOfMonthlyPayments) - 1))) * loanAmount;
        }
        else
            return 0;
    }

Cheers
Tails8

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s