Reference no: EM1332690
Write a Visual Basic 2010 program to analyze a mortgage. The user should enter the amount of the loan, the annual rate of interest, and the duration of the loan in months. When the user clicks on the button, the information that was entered should be checked to make sure that it is reasonable. If bad data have been supplied, the user should be advised about it. Otherwise, the monthly payment and the total amount of interest paid should be displayed.
The formula for the monthly payment is
payment =p*r/(1-(1+r)^(-n))
where p is the amount of the loan, r is the monthly interest rate (annual rate divided by 12) given as a number between 0 (for 0 percent) and 1 (for 100 percent), and n is the duration of the loan in months.
The formula for the total interest paid is
total interest =n*payment -p.
Test the program for a mortgage of $240,000 at 6% annual rate of interest, and duration 360 months. Such a mortgage will have a monthly payment of $1,438.92 and total interest of $278,011.65.