Explore BrainMass
Share

Perl Program - Mortgage Calculator

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

Write a mortgage calculator PERL(.cgi) program that asks the user for the following information:
1. Loan amount
2. Number of years
3. Percent per year compound interest
Use the following formula to determine the total amount of each payment:
n = months * 12
r = percent per year compound interest
L = loan amount
P = Lr(1+r/1200)^n/[1200{(1+r/1200)^n - 1}]
The program must include a...
1. An array
2. A print function
3. One conditional component
4. One subroutine
Example:
If the loan was $20,000 over 15 years at 12 percent the repayment would be $240.08

© BrainMass Inc. brainmass.com October 24, 2018, 10:07 pm ad1c9bdddf
https://brainmass.com/computer-science/perl/149200

Attachments

Solution Preview

Dear Student,

Attached is the perl file. It has all the things that the implementation asked for.

The formula seems to be incorrect. With the formula that you have given in the question, I was not getting the right mortage value. May be if you give me the right formula with ...

Solution Summary

Write a mortgage calculator PERL(.cgi) program that asks the user for the following information:
1. Loan amount
2. Number of years
3. Percent per year compound interest
Use the following formula to determine the total amount of each payment:
n = months * 12
r = percent per year compound interest
L = loan amount
P = Lr(1+r/1200)^n/[1200{(1+r/1200)^n - 1}]
The program must include a...
1. An array
2. A print function
3. One conditional component
4. One subroutine
Example:
If the loan was $20,000 over 15 years at 12 percent the repayment would be $240.08

$2.19
See Also This Related BrainMass Solution

Perl program update

Please apply the following formula below to the program so it works correctly!

The following formula is used to calculate the fixed monthly payment (P) required to fully amortize a loan of L dollars over a term of n months at a monthly interest rate of c. [If the quoted rate is 6%, for example, c is .06/12 or .005].

P = L[c(1 + c)n]/[(1 + c)n - 1]

I am currently getting the following errors

Number found where operator expected at calc.cgi line 38, near "#P = Lr(1+r/1200"
(Might be a runaway multi-line // string starting on line 15)
(Do you need to predeclare P?)
Unquoted string "n" may clash with future reserved word at mor_calc.cgi line 38.
Unquoted string "r" may clash with future reserved word at mor_calc.cgi line 38.
Unquoted string "n" may clash with future reserved word at mor_calc.cgi line 38.
Scalar found where operator expected at mor_calc.cgi line 39, near "$num_months"
(Missing semicolon on previous line?)
syntax error at mor_calc.cgi line 38, near "P = Lr(1+r/1200"
Missing right curly or square bracket at mor_calc.cgi line 61, at end of line
Execution of calc.cgi aborted due to compilation errors.

Thank you!

View Full Posting Details