Cibc Auto Loan Calculator Jamaica

CIBC Auto Loan Calculator Jamaica

Calculation Steps

function calculateAutoLoan() { var loanAmount = parseFloat(document.getElementById(“loanAmount”).value); var loanTerm = parseInt(document.getElementById(“loanTerm”).value); var interestRate = parseFloat(document.getElementById(“interestRate”).value) / 100; if (isNaN(loanAmount) || isNaN(loanTerm) || isNaN(interestRate) || loanAmount <= 0 || loanTerm <= 0 || interestRate <= 0) { alert("Please enter valid positive values for all fields."); return; } var monthlyInterestRate = interestRate / 12; var numberOfPayments = loanTerm * 12; var monthlyPayment = (loanAmount * monthlyInterestRate) / (1 – Math.pow(1 + monthlyInterestRate, -numberOfPayments)); document.getElementById("monthlyPayment").value = monthlyPayment.toFixed(2); var calculationDetails = "Loan Amount: " + loanAmount.toFixed(2) + " JMD\n"; calculationDetails += "Interest Rate: " + (interestRate * 100).toFixed(2) + "%\n"; calculationDetails += "Loan Term: " + loanTerm + " years\n"; calculationDetails += "Monthly Payment: " + monthlyPayment.toFixed(2) + " JMD"; document.getElementById("calculationDetails").innerText = calculationDetails; document.getElementById("calculationSteps").style.display = "block"; }

Leave a Reply

Your email address will not be published. Required fields are marked *