Calculator Rate Leasing

Lease Rate Calculator

This calculator helps you understand the effective monthly rate for a leasing agreement by considering the initial cost, monthly payments, and lease duration.

function calculateLeaseRate() { var initialCost = parseFloat(document.getElementById("initialCost").value); var monthlyPayment = parseFloat(document.getElementById("monthlyPayment").value); var leaseTermMonths = parseFloat(document.getElementById("leaseTermMonths").value); var resultDiv = document.getElementById("result"); resultDiv.innerHTML = ""; // Clear previous results if (isNaN(initialCost) || isNaN(monthlyPayment) || isNaN(leaseTermMonths) || initialCost < 0 || monthlyPayment < 0 || leaseTermMonths <= 0) { resultDiv.innerHTML = "Please enter valid positive numbers for all fields. Lease term must be greater than 0."; return; } var totalPayments = initialCost + (monthlyPayment * leaseTermMonths); var effectiveMonthlyRate = totalPayments / leaseTermMonths; resultDiv.innerHTML = "

Estimated Effective Monthly Rate:

" + effectiveMonthlyRate.toFixed(2) + ""; } #leasing-calculator { font-family: sans-serif; max-width: 500px; margin: 20px auto; padding: 20px; border: 1px solid #ddd; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); } .input-group { margin-bottom: 15px; } .input-group label { display: block; margin-bottom: 5px; font-weight: bold; } .input-group input { width: calc(100% – 22px); padding: 10px; border: 1px solid #ccc; border-radius: 4px; } button { background-color: #4CAF50; color: white; padding: 10px 15px; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; } button:hover { background-color: #45a049; } #result { margin-top: 20px; padding-top: 15px; border-top: 1px solid #eee; } #result h3 { margin-top: 0; }

Leave a Comment