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

Web Loan Calculator C# ASP Project

This is another test project that does loan amortization. I had to do some quick learning on the loan amount, interest rate, and duration formula. I’m experimenting with different ways to get things done in the back-end code then having the results, work, etc.., display on the webpage. I’ll be getting into creating full sites in the next few posts. However these are just static pages that just display functionality.

I’ve also added conditions to the page that the user has to fill out all of the required fields otherwise errors will display. I’m also playing around with different ways of getting the form data and saving it for later use.

Default.aspx & Error Display Pages

WebLoanCalculatorMainPage WebLoanCalculatorError

Continue reading