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]
2 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]2 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
Explain in brief terms some of the technology and developments that were important in the history and development of the Interne
igomit [66]

Answer: The Internet started in the 1960s as a way for government researchers to share information. ... This eventually led to the formation of the ARPANET (Advanced Research Projects Agency Network), the network that ultimately evolved into what we now know as the Internet.

Have a nice day ahead :)

7 0
2 years ago
Two devices that may be used for creating,storing,and transmitting documents input devices
castortr0y [4]

Answer:

electronic notebook or a pc?

Explanation:

sorry if its wrong of doesnt help

6 0
3 years ago
________ is malware that hijacks a user's computer and demands payment in return for giving back access.
Lera25 [3.4K]

Ransom  malware that hijacks a user's computer and demands payment in return for giving back access.

<h3>What is Ransom malware?</h3>

This is known to be a kind of  malware that hinders users from gaining in or access to their system or personal files and it is one that often demands ransom payment so as to get access.

Therefore, Ransom  malware that hijacks a user's computer and demands payment in return for giving back access.

Learn more about Ransom  malware from

brainly.com/question/27312662

#SPJ12

6 0
1 year ago
The U.S. continues to become more dependent on the global domain within the information environment consisting of the interdepen
cupoosta [38]

Answer:

cyberspace

Explanation:

It is the notional environment in which communication over computer networks occurs.

5 0
3 years ago
Permission must be sought in order to use a play that is in the public domain. True or False?
sertanlavr [38]

Answer:

False

Explanation:

Permission can't be sought in order to use a play that is in the public domain.

5 0
3 years ago
Read 2 more answers
Other questions:
  • What is the correct process for inserting a blank worksheet in Google sheets
    12·1 answer
  • As a photographer, what will be the driving force behind everything that you produce?
    13·1 answer
  • Which statement describes one drive?
    6·1 answer
  • Who is a data base administrator
    12·1 answer
  • Allows a user to control the<br>volume of the computer​
    8·1 answer
  • State two function of protein in the body
    8·1 answer
  • NEED HELP FAST timed
    13·1 answer
  • PLEASE HELP WILL MARK BRAINLIEST
    8·2 answers
  • Which type of computer is used microprocessor​
    5·1 answer
  • What is this line called that appears and disappears in the search box<br><br> WILL MARK BRAINLIEST
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!