**PROGRAMMING EXERCISE**

**Loan Calculation**

Write a VB program that allows a user to input the loan amount, interest rate, and number of years to pay off the loan. When the user then clicks the "Calculate" button, the program should display the monthly payment, total amount that will be paid out over the life of the loan, and the cost of credit. The form should also contain a "Clear" button, which allows a user to perform a new calculation, and an "Exit" button, which allows a user to exit the program. The form should use appropriate tabbing order and access keys.

The monthly payment is computed as follows:

Rate(1 + Rate)^{N}

Payment = --------------- X Loan

(1 + Rate)^{N}
- 1

where Payment = monthly payment

Rate = monthly interest rate

N = number of payments in months

Loan = amount of loan

You will need to convert the annual interest rate to the monthly rate by dividing the annual rate by 12 and then by 100 (or by 1200). Convert the time in years to the number of monthly payments by multiplying by 12.

The total amount paid is the monthly payment times the number of years times 12. The cost of credit is the total amount paid minus the loan amount.

For example, if I want to finance $14,000 to be paid out over four years at an interest rate of 7%, I would enter the following values:

Loan Amount: **14000**

Interest Rate: **7**

Number of Years: **4**

The program should then come up with the following results:

Monthly Payment: **$335.25**

Total to be Paid: **$16,091.88**

Cost of Credit: **$2,091.88**

** **

A sample run of the program is shown below:

After you have written this
program, look up the **Pmt** function in the MSDN Help (if available).
Create an alternative version of the program that uses the Pmt function rather
than computing it "manually".

Download the solution for this project (using "manual" calculations) here.

Download the solution for
this project (using the **Pmt** function) here.