1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
tamaranim1 [39]
3 years ago
8

A file named loan.html, write an HTML document that looks similar to figure 9-7 in the textbook. Write four functions with these

headers:
function doPayment ( )
function doBalance ( )
function computePayment (principal, annualRate, years, periodsPerYear)
function computeBalance (principal, annualRate, years, periodsPerYear, numberOfPaymentPaidToDate)
The first two functions (doPayment and doBalance) do the following:

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 d payments have been made is

b = a (1 + r)d − p ( (1 + r)d − 1 )
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 d is the number of payments paid to date.
Computers and Technology
1 answer:
jok3333 [9.3K]3 years ago
6 0

Answer:

function computePayment(principal, annualRate, periodsPerYear){

   var pay;

   pay = (principal * annualRate)/(1-(1+annualRate)-periodsPerYear);

   return pay;

}

function computeBalance(principal, annualRate, periodsPerYear, numberOfPaymentsPaidToDate){

   var balance ;

   let num = (principal*(1+annualRate)*periodsPerYear);

   let denum = numberOfPaymentsPaidToDate *((1+annualRate) * periodsPerYear-1)*annualRate;

   balance = num-denum;

   return balance;

}

function doPayment(){

   let loanAmount = document.getElementById("principal").value;

   let rate = document.getElementById("rate").value;

   let duration = document.getElementsById("time").value;

   let result = computePayment(loanAmount, rate, duration);

   document.getElementsById("periodPay").value = result;

}

function doBalance(){

   let loanAmount = document.getElementById("principal").value;

   let rate = document.getElementById("rate").value;

   let duration = document.getElementById("time").value;

   let currentPaid = document.getElementById("paidMonths").value;

   let result = computeBalance(loanAmount, rate, duration, currentPaid);

   document.getElementById("displayBalance").value = result;

}

Explanation:

The javascript source code defines four functions. The 'doPayment' and 'doBalance' functions are initiated with the onclick properties of the HTML file buttons of the loan calculator. The doPayment function gets the user input from the HTML file and assigns them to variable which are used as the parameters of the computePayment function called.

The doBalance function also retrieve user input from the HTML file and calls the computeBalance function to calculate and return the balance of the loan to be paid.

You might be interested in
I am gay shdddddddddddddddddddddddd
Natasha_Volkova [10]

Answer:

cool

Explanation:

i guess

4 0
3 years ago
From the Start screen, you can
saul85 [17]
Depends on brand or model of computer. mine would be D.
8 0
3 years ago
Read 2 more answers
write a python program to find all words in a string which are at least 6 characters long and starts with a capital ‘a’ or small
lawyer [7]

Answer:

. Write a Python program to check that a string contains only a certain set of characters (in this case a-z, A-Z and 0-9)

Explanation:

. Write a Python program to check that a string contains only a certain set of characters (in this case a-z, A-Z and 0-9)

3 0
2 years ago
Which of these reduces friction and makes the job of moving a freezer easier?
laila [671]
Using a hand truck to move the freezer would make it easier and remove the element of friction between the freezer and the floor 100%
6 0
3 years ago
In Python, what does this command do:<br>print ("\n")​
Svetradugi [14.3K]
It creates a new line
3 0
3 years ago
Other questions:
  • this isnt a question but i am looking for anything willing to help me with my work. i have 50 missing assignments just in one cl
    7·1 answer
  • Name the written test a potential driver must pass
    5·1 answer
  • Joanna accidentally leaned on her keyboard and repeatedly typed the letter z. How can she fix this mistake?
    6·2 answers
  • What is the process in which a server is partitioned into smaller components virtually
    12·2 answers
  • In a new blank word document you can typing where ?
    15·1 answer
  • If you could represent yourself with one object from your home what would it be ?
    9·2 answers
  • PLEASE READ ( if you want ) Before i used to have over 30 brainliest and i was just trying to earn points so i could get to ace,
    9·1 answer
  • Complete the static method stringSearch, which returns a String that tells where the first occurrence of the characters (chr) we
    12·1 answer
  • 4.9 Code Practice: Question 2
    11·2 answers
  • ____________ refers to bits that have been changed, in error, from 1 to 0, or vice versa, in a data transmission.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!