Computer Science Homework Solutions
Problem
#150301

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!

Attached file(s):
Attachments
perl+calculator+program.doc  View File

Attachment Content Summary (Note: view attachment at the above link before purchasing. Actual attachment content may vary slightly from that shown below.)

perl+calculator+program.doc
Write a mortgage calculator PERL(.cgi) program that asks the user for
the following information:

Loan amount

Number of years

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…

An array

A print function

One conditional component

One subroutine

Example:

If the loan was $20,000 over 15 years at 12 percent the repayment would
be $240.08

Solution Summary

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.

Solution
What is this?
By OTA - Overall OTA Rating
Purchase Cost Now
$2.19 CAD (was ~$3.99)
Included in Download
  • Plain text response
  • Attached file(s):
    • new_mor_cal.pl
    • result.log
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
Browse