Calculator credite

Introduceți textul aici...

Calculator Credit pentru Locuințe

Calculator Credit

Rezultatul

Plata lunară:

Plata totală:

Dobânda totală:

function updateInterestRate() { const creditType = document.getElementById('creditType').value; let interestRate = 5.5; // Default: Credit pentru Locuință if (creditType === "personal") { interestRate = 8.0; // Credit Personal } else if (creditType === "primaCasa") { interestRate = 4.9; // Credit Prima Casă } document.getElementById('interestRate').value = interestRate; } function calculateCredit() { const loanAmount = parseFloat(document.getElementById('loanAmount').value); const loanTerm = parseFloat(document.getElementById('loanTerm').value); const interestRate = parseFloat(document.getElementById('interestRate').value) / 100 / 12; // Dobânda lunară const numberOfPayments = loanTerm * 12; // Numărul total de plăți (luni) // Formula pentru plata lunară const monthlyPayment = loanAmount * interestRate / (1 - Math.pow(1 + interestRate, -numberOfPayments)); // Calculul plăților și dobânzilor const totalPayment = monthlyPayment * numberOfPayments; const totalInterest = totalPayment - loanAmount; // Afișarea rezultatelor document.getElementById('monthlyPayment').innerText = `Plata lunară: ${monthlyPayment.toFixed(2)} RON`; document.getElementById('totalPayment').innerText = `Plata totală: ${totalPayment.toFixed(2)} RON`; document.getElementById('totalInterest').innerText = `Dobânda totală: ${totalInterest.toFixed(2)} RON`; } body { font-family: Arial, sans-serif; background-color: #333; color: #d4af37; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .calculator { background-color: #000; padding: 20px; border-radius: 10px; box-shadow: 0 0 15px rgba(212, 175, 55, 0.5); width: 300px; } h2, h3 { text-align: center; } .form-group { margin-bottom: 15px; } label { display: block; margin-bottom: 5px; } input { width: 100%; padding: 8px; margin-bottom: 10px; border: 1px solid #d4af37; border-radius: 5px; background-color: #333; color: #d4af37; } button { width: 100%; padding: 10px; background-color: #d4af37; border: none; border-radius: 5px; color: #000; font-weight: bold; cursor: pointer; } button:hover { background-color: #b79729; } .result { margin-top: 20px; text-align: center; }