{ "key_pair_value_system": true, "answer_rating_count": "", "question_feedback_html": { "html_star": "", "html_star_feedback": "" }, "answer_average_rating_value": "", "answer_date_js": "2024-09-06T02:24:04-04:00", "answer_date": "2024-09-06 02:24:04", "is_docs_available": null, "is_excel_available": null, "is_pdf_available": null, "count_file_available": 0, "main_page": "student_question_view", "question_id": "9266279", "url": "\/study-help\/questions\/please-help-this-code-is-not-computing-correctly-there-must-9266279", "question_creation_date_js": "2024-09-06T02:24:04-04:00", "question_creation_date": "Sep 06, 2024 02:24 AM", "meta_title": "[Solved] Please help this code is not computing co | SolutionInn", "meta_description": "Answer of - Please help this code is not computing correctly. There must be something wrong with the formula. I can't figure it ou | SolutionInn", "meta_keywords": "help,code,computing,correctly,wrong,formula,figure,criteria,assignment,write,four,functions", "question_title_h1": "Please help this code is not computing correctly. There must be something wrong with the formula. I can't figure it out. Here is the criteria", "question_title": "Please help this code is not computing correctly. There must be something", "question_title_for_js_snippet": "Please help this code is not computing correctly There must be something wrong with the formula I can't figure it out Here is the criteria for the assignment Write four functions with these headers function doPayment() function doBalance() function computePayment(principal, annualRate, years, periodsPerYear) function computeBalance(principal, annualRate, years, periodsPerYear, numberOfPaymentsPaidToDate) The first two functions (doPayment and doBalance) take no parameters are called from an onclick attribute get input from the user call the computePayment or the computeBalance function display a result to the user The computePayment function computes and returns the monthly payment for a loan with a fixed annual interest rate The formula for computing a loan payment is P ar 1(1 r) n where p is the payment per period, a is the loan amount, r is the interest rate per period , and n is the total number of periods throughout the life of the loan The computeBalance function computes and returns the balance for a loan with a fixed annual interest rate The formula for computing the balance of a loan after n payments have been made is b a(1 r) n p((1 r) n1) r where b is the balance or payoff amount, a is the loan amount, r is the interest rate per period , p is the payment per period, and n is the number of payments paid to date Loan Calculator Loan Calculator Amount borrowed (Principal) Annual Interest Rate (for example 0 065) Number of years Payments per years Number of payment paid to date function doPayment() let principal document getElementById('principal') value let annualRate document getElementById('annualRate') value let years document getElementById('years') value let payperyear document getElementById('payperyear') value document getElementById('Payment') value '$' computePayment(principal,annualRate,years,payperyear) fs function doBalance() let principal document getElementById('principal') value let annualRate document getElementById('annualRate') value let years document getElementById('years') value let payperyear document getElementById('payperyear') value let paid document getElementById('paid') value document getElementById('Payoff') value '$' computeBalance(principal,annualRate,years,payperyear,paid) function computeBalance(principal, annualRate, years, periodsPerYear, numberOfPaymentsPaidToDate) return principal Math pow((1 annualRate),numberOfPaymentsPaidToDate) periodsPerYear Math pow(1 annualRate,numberOfPaymentsPaidToDate 1) annualRate ", "question_description": "
Please help this code is not computing correctly. There must be something wrong with the formula. I can't figure it out.<\/p>
Here is the criteria for the assignment:<\/p>
Write four functions with these headers:<\/p>
function doPayment() function doBalance() function computePayment(principal, annualRate, years, periodsPerYear) function computeBalance(principal, annualRate, years, periodsPerYear, numberOfPaymentsPaidToDate) <\/pre>The first two functions (doPayment and doBalance)<\/p>
take no parameters<\/p>
are called from an onclick attribute<\/p>
get input from the user<\/p>
call the computePayment or the computeBalance function<\/p>
display a result to the user<\/p>
The computePayment function computes and returns the monthly payment for a loan with a fixed annual interest rate. The formula for computing a loan payment is<\/p>
P = ar\/1(1+r)^n<\/p>
where p is the payment per period, a is the loan amount, r is the interest rate per period<\/em>, and n is the total number of periods<\/em> throughout the life of the loan.<\/p>
The computeBalance function computes and returns the balance for a loan with a fixed annual interest rate. The formula for computing the balance of a loan after n payments have been made is<\/p>
b =a(1+r)^n p((1+r)^n1)\/r<\/p>
where b is the balance or payoff amount, a is the loan amount, r is the interest rate per period<\/em>, p is the payment per period, and n is the number of payments paid to date<\/em>.<\/p>
Loan Calculator<\/title> <\/head> Loan Calculator<\/h1>