Public Bank Loan Calculator
Public Bank Loan Calculator
Not calculated yet.
Loan Amount: ${formatCurrency(amount)}
Loan Term: ${term} years
Interest Rate: ${(rate * 100).toFixed(1)}%
`; loanSteps += `Formulas:
Monthly Payment = Loan Amount × Monthly Rate × (1 + Monthly Rate)^Number of Payments / ((1 + Monthly Rate)^Number of Payments – 1)
Total Payment = Monthly Payment × Number of Payments
`; loanSteps += `Results:
Monthly Payment: ${formatCurrency(monthlyPayment)}
Total Payment: ${formatCurrency(totalPayment)}
`; if(document.getElementById(“calculationSteps”).style.display === “block”){ document.getElementById(“calculationSteps”).innerHTML = loanSteps; } } function resetLoan(){ document.querySelectorAll(“#calculator input”).forEach(el => el.value = “”); loanSteps = “”; document.getElementById(“calculationSteps”).innerHTML = “
Not calculated yet.
“; } function toggleCalculationSteps(){ const steps = document.getElementById(“calculationSteps”); const arrow = document.getElementById(“toggleArrow”); if(steps.style.display === “none” || steps.style.display === “”){ steps.style.display = “block”; arrow.style.transform = “rotate(180deg)”; steps.innerHTML = loanSteps || “Not calculated yet.
“; } else { steps.style.display = “none”; arrow.style.transform = “rotate(0deg)”; } } function formatCurrency(n) { return currencySymbol + n.toFixed(2) + ” ” + fixedCurrency; }