Bpi Personal Loan Calculator

BPI Personal Loan Calculator

function calculateLoan() { const loanAmount = parseFloat(document.getElementById(‘loanAmount’).value); const loanTerm = parseFloat(document.getElementById(‘loanTerm’).value); const interestRate = parseFloat(document.getElementById(‘interestRate’).value); if (isNaN(loanAmount) || isNaN(loanTerm) || isNaN(interestRate) || loanAmount <= 0 || loanTerm <= 0 || interestRate <= 0) { alert('Please enter valid positive numbers.'); return; } const monthlyInterestRate = (interestRate / 100) / 12; const numberOfPayments = loanTerm * 12; const monthlyPayment = (loanAmount * monthlyInterestRate) / (1 – Math.pow(1 + monthlyInterestRate, -numberOfPayments)); document.getElementById('monthlyPayment').value = monthlyPayment.toFixed(2); } function resetForm() { document.getElementById('bpi-personal-loan-form').reset(); document.getElementById('monthlyPayment').value = ''; }

Leave a Reply

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