Question

USE Javascript. Loan Calculator: Three input boxes for annual interest rate, number of years, and...

USE Javascript.

Loan Calculator: Three input boxes for annual interest rate, number of years,
and loan amount for user input. Display the output monthly payment and total payment
also to input boxes. Add the Reset button to clear all text boxes after the Compute Payment button.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is code:

<!-- Name : xxxx

Date : xxxx

Purpose : To Calculate the area of Rectangle and area of Triangle -->

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<title>Loan Calculator</title>

<meta name="viewport" content="width=device-width, initial-scale=1">

<script>

function start() {

var button = document.getElementById("btnCalculate");

button.addEventListener("click", displayDistance, false);

var button = document.getElementById("btnReset");

button.addEventListener("click", reset, false);

}

function displayDistance() {

var rate = Number(document.getElementById("txtRate").value);

var year = Number(document.getElementById("txtYears").value);

var loan = Number(document.getElementById("txtLoan").value);

var total = loan + (loan * (rate / 100));

var monthly = total / (year * 12);

document.getElementById("txtMonthly").value = monthly;

document.getElementById("txtTotal").value = total;

}

function reset() {

document.getElementById("txtRate").value = "";

document.getElementById("txtYears").value = "";

document.getElementById("txtLoan").value = "";

document.getElementById("txtMonthly").value = "";

document.getElementById("txtTotal").value = "";

}

window.addEventListener("load", start, false);

</script>

</head>

<body>

<form action="#" id="frmCalculator">

<table>

<tbody>

<tr>

<th>Loan Calculator</th>

</tr>

<tr>

<td>annual interest rate</td>

<td><input type="text" name="txtRate" id="txtRate"></td>

</tr>

<tr>

<td>number of years</td>

<td><input type="text" name="txtYears" id="txtYears"></td>

</tr>

<tr>

<td>loan amount</td>

<td><input type="text" name="txtLoan" id="txtLoan"></td>

</tr>

<tr>

<td><input type="button" id="btnReset" value="Reset"></td>

<td><input type="button" id="btnCalculate" value="Calculate"></td>

</tr>

<tr>

<td>monthly payment</td>

<td><input type="text" disabled=true readonly name="txtMonthly" id="txtMonthly"></td>

</tr>

<tr>

<td>total payment</td>

<td><input type="text" name="txtTotal" id="txtTotal"></td>

</tr>

</tbody>

</table>

</form>

</body>

</html>

Output:

Loan Calculator annual interest rate 10 number of years loan amount 1000 Calculate monthly payment 18.333333333333332 total p

Add a comment
Know the answer?
Add Answer to:
USE Javascript. Loan Calculator: Three input boxes for annual interest rate, number of years, and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C# Create an application that will allow a loan amount, interest rate, and number of finance...

    C# Create an application that will allow a loan amount, interest rate, and number of finance years to be entered for a given loan. Determine the monthly payment amount. Calculate how much interest will be paid over the life of the loan. Display an amortization schedule showing the new balance after each payment is made. Design an object-oriented solution. Use two classes. Loan class: characteristics such as the amount to be financed, rate of interest, period of time for the...

  • 6. Loan Calculator The e most common types of loans are mortgage loans, which are tinance...

    6. Loan Calculator The e most common types of loans are mortgage loans, which are tinance the purchase of a house, and car loans. A loan consists of four com- L1 ponents--amount, interest rate, duration, and periodic payment. The purpose values of the other three components. prograrmming project is to calculate the value of any one of the components given the We will ascurme that the duration is in months, that interest (given as a percent) i gages typically have...

  • Please help me do this program. Add some comments on it. *15.5 (Create an investment-value calculator)...

    Please help me do this program. Add some comments on it. *15.5 (Create an investment-value calculator) Write a program that calculates the future value of an investment at a for the calculation is given interest rate for a specified number of years. The formula investmentAmount * (1monthlyInterestRate ) years *12 futureValue Use text fields for the investment amount, number of years, and annual interest rate. Display the future amount in a text field when the user clicks the Calculate button,...

  • CIS 221 Loan Calculator Enhancement Introduction You are a systems analyst working for a company that...

    CIS 221 Loan Calculator Enhancement Introduction You are a systems analyst working for a company that provides loans to customers. Your manager has asked you to enhance and correct their existing Loan Calculator program, which is designed to calculate monthly and total payments given the loan amount, the annual interest rate, and the duration of the loan. Although the current version of the program (hereby termed the “As Is” version) has some functionality, there are several missing pieces, and the...

  • ***JAVASCRIPT*** I need JAVASCRIPT codes for this question. Also a little explanation and full screenshots of...

    ***JAVASCRIPT*** I need JAVASCRIPT codes for this question. Also a little explanation and full screenshots of the codes. Short 6-1 Upgrade the MPG application In this exercise, you'll upgrade a version of the MPG application so the error messages are displayed in span elements to the right of the text boxes. Estimated time: 10 to 15 minutes. Calculate Miles Per Gallon Miles Driven Mies must be numeric and greater than zero Gallons of Gas Used Gallons must be numeric and...

  • IT MUST USE PHP AND HTML IT CANT BE JAVASCRIPT IT HAS TO BE PHP AND...

    IT MUST USE PHP AND HTML IT CANT BE JAVASCRIPT IT HAS TO BE PHP AND HTML Using PHP and HTML 5, create a webpage that calculates the monthly payment for a car loan. The user enters the price of the car (P), down payment (D), Annual Percentage Rate (R), and the number of years (N). Compute the monthly payment (M) using the following formula and display it: Let i = R / 1200 and n = N * 12;...

  • Write a calculator program using JavaScript in HTML in the same HTML file. (There will only...

    Write a calculator program using JavaScript in HTML in the same HTML file. (There will only be 1 HTML file containing everything that you use for this program.) *************JavaScript Functions should be written in the HTML <head> .............. </head> tag, **************** (Please be mindful of the formatting of the text of your program. Meaning that do not copy paste everything in a single line. Add clear comments for a better understanding of your program) as follows Assignment: create a form...

  • Consider a $15,000 loan with an annual interest rate of 9%, a term of four years,...

    Consider a $15,000 loan with an annual interest rate of 9%, a term of four years, anda monthly payment of A (5 points) What is the amount of the monthly payment? a. (10 points) Ifyou pay $750 per month, how many months will it take to repay the loan? b. (10 points) If you pay $750 per month on this loan, how much will the final payment C. be? Consider a $15,000 loan with an annual interest rate of 9%,...

  • MATLAB!!! CAN SOMEONE SOLVE THIS PROBLEM ON MATLAB?? THANK YOU PART B: HOUSING LOAN CALCULATOR In this part of the assignment, you are expected to develop a program that calculates housing loan pay-...

    MATLAB!!! CAN SOMEONE SOLVE THIS PROBLEM ON MATLAB?? THANK YOU PART B: HOUSING LOAN CALCULATOR In this part of the assignment, you are expected to develop a program that calculates housing loan pay- ments based on compound interest formulas The program should prompt a user to input the amount borrowed (principal), p, the number of monthly payments, n, and an annual interest rate in R percent. The program should convert the annual interest rate R into a monthly interest rate...

  • Program Specification: This project involves implementing a Java program that performs a calculation of payments associated...

    Program Specification: This project involves implementing a Java program that performs a calculation of payments associated with loans. The program shall allow a user to enter the following data: annual interest rate the loan (i.e. , number of years), and the loan amount. A GUI like the one below must be used. Loan Calculator Annual Interest Rate: Number of Years Loan Amount: Monthly Payment Total Payment Calculate When the user presses the calculate button, the monthly payment and total amount...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT