Cibc Barbados Car Loan Calculator

CIBC Barbados Car Loan Calculator

Monthly Payment: BBD

Total Interest: BBD

Total Loan Amount: BBD

function calculateLoan() { const loanAmount = parseFloat(document.getElementById(“loanAmount”).value); const interestRate = parseFloat(document.getElementById(“interestRate”).value) / 100 / 12; const loanTerm = parseInt(document.getElementById(“loanTerm”).value) * 12; if (isNaN(loanAmount) || isNaN(interestRate) || isNaN(loanTerm) || loanAmount <= 0 || interestRate <= 0 || loanTerm <= 0) { alert("Please enter valid values."); return; } const monthlyPayment = (loanAmount * interestRate) / (1 – Math.pow(1 + interestRate, -loanTerm)); const totalInterest = (monthlyPayment * loanTerm) – loanAmount; const totalLoanAmount = loanAmount + totalInterest; document.getElementById("monthlyPayment").textContent = monthlyPayment.toFixed(2); document.getElementById("totalInterest").textContent = totalInterest.toFixed(2); document.getElementById("totalLoanAmount").textContent = totalLoanAmount.toFixed(2); }

Leave a Reply

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