Using PHP create a loan calculator that allows for extra payments.

profilemdimond88

 

Requirements:

  • -Create a page that allows a user to enter loan information; including Loan Amount, Length of Loan (months or years), Annual Interest Rate (percentage), and Extra Payment Amount.
  • -Loan Amount is in dollars. This field is required.
  • -Length of Loan is an integer in months or years. Include a prompt (such as radio buttons or dropdown list) to indicate payment frequency is for months or years. This field is required.
  • -The loan calculation should adjust appropriately based on months or years selection.
  • -Annual Interest Rate should be entered as a percentage. This field is required.
  • -Make sure that all required fields are entered.
  • -Make sure that all entered fields are valid.
  • -Display the results of the loan calculation.
  • -Display the Monthly Payment Amount.
  • -Display the Total Amount to be paid for the loan (principle and interest).
  • -Display the Total Interest to be paid for the loan.
  • -Display an Amortization Schedule for the loan.
  • -Assume the loan starts on the first day of the following month.
  • -In the Amortization Schedule show the Payment Number, Payment Date, Payment Amount, Principle Amount, Interest Amount, Extra Payment Amount (if entered), and Loan Balance.

Extra Credit:

  • -Extra Payment Amount is in dollars and is an additional monthly amount paid towards the principle of the loan. This field is optional.
  • -If Extra Payment Amount is entered, it must be included in the loan calculation.
  • -The Extra Payment Amount should be included as part of the monthly payment.
  • -If Extra Payment Amount is entered, display the Amount of Interest Saved and the Amount of Time Saved.
  • -Store the values entered in cookies and auto populate fields with previous values from cookies.

Hints:

  • -Find a formula to calculate the payment amount.
    • -To use the formula you will need to calculate a few things based on the user input.
    • -You will need to know the number of monthly payments for the loan. Your formula might call this the length of the loan.
    • -You will need to know the interest rate per month.
  • -Now you can start.
  • -Calculate the number of monthly payments.
  • -Calculate the interest rate per month.
  • -Calculate the payment amount.
  • -You should test this by calculating manually on paper and using a php fiddle to test your code calculations.
  • -Compare your results to any online mortgage calculator.
  • -Now use a loop to display each month of the amortization table.
  • -For each month calculate the balance and the portion of the payment that is principal and interest.
  • -For the first month, the balance is the same as the loan amount.
  • -The interest portion of the payment for that month is the balance times the interest rate per month.
  • -The principal portion of the payment for that month is the payment amount minus the interest portion.
  • -The balance for that month is the balance from the previous month minus the principal portion of the payment.
  • 4 years ago
  • 80
Answer(1)

Purchase the answer to view it

blurred-text
NOT RATED
  • attachment
    loan_calculator.php