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
Int value[10] = {1, -7, 95, 123, 80, 67, -30, 17, 152, 121} ;
Lorico [155]

Answer:

<u>for loop code:</u>

int total=0;

for(int i=0;i<10;i++)

{

total + = value[i];

}

Explanation:

By declaration we know that the array is of size 10 which means the index will start from 0.

The variable name to be used to store the sum is given as total

We will initialize total with zero so that no garbage value is used.

For loop will be used to access the elements of array and calculate the sum. The syntax of for loop is given as:

for (initialization; condition; increment/decrement)

   {statement}

<u>Code:</u>

int total=0;

for(int i=0;i<10;i++)

{

total + = value[i];

}

8 0
3 years ago
Sally needs to copy data from the first worksheet to the fifth worksheet in her workbook. Which combination of keys will she use
Marta_Voda [28]

To make things faster, instead of using your mouse to navigate multiple Microsoft Excel sheets that are in the same document, you can use a shortcut instead. This is what Sally will be doing to copy data from her first worksheet to the fifth.

The shortcut function that Sally needs to use to achieve this is (A) Ctrl and Page Up or Page Down Keys.

7 0
3 years ago
Read 2 more answers
We are sending a 30 Mbit MP3 file from a source host to a destination host. All links in the path between source and destination
Daniel [21]

Answer:

Option  A is the correct answer.

Explanation:

8 0
3 years ago
Which of the following is a primary disadvantage of using a GUI HTML editor to develop your Webpages?
lora16 [44]

Answer:

C (Most feasible option)

Explanation:

I am not sure but option C seems most probable, all other options do not seem to be true

7 0
2 years ago
Explain the role of computers in accounting
Inessa05 [86]

Answer:

A computer helps accountants store and access financial records, make changes and alleviate the need to keep paper files. If paper work is needed, computer files can easily be accessed and printed along with any changes the accountant makes at any given time.

8 0
2 years ago
Other questions:
  • The ____ contains methods that allow you to set physical properties such as height and width, as well as methods that allow you
    14·1 answer
  • You use a ____ following the closing brace of an array initialization list.
    12·2 answers
  • They begin beating it with a hose to find out what it really means. How does the figurative language in this excerpt reveal Coll
    9·2 answers
  • What is the correct process for inserting a blank worksheet in Google sheets
    12·1 answer
  • A stateless firewall inspects each incoming packet to determine whether it belongs to a currently active connection.
    9·1 answer
  • What is the data type of the following expression?
    12·2 answers
  • Which of the following candidates would most likely be hired as a graphic artist?
    15·2 answers
  • Page Setup options are important for printing a PowerPoint presentation a certain way. The button for the Page Setup dialog box
    15·1 answer
  • PLEASE HELP! :)
    14·1 answer
  • The second generation of computer languages is a higher-level language than
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!