Cd Deposit Rate Calculator

CD Deposit Rate Calculator body { font-family: sans-serif; line-height: 1.6; margin: 20px; } .calculator-container { border: 1px solid #ccc; padding: 20px; border-radius: 8px; max-width: 600px; margin: auto; } .input-group { margin-bottom: 15px; } label { display: block; margin-bottom: 5px; font-weight: bold; } input[type="number"] { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; } 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: 15px; background-color: #e9e9e9; border: 1px solid #ccc; border-radius: 4px; } h2 { text-align: center; margin-bottom: 20px; }

CD Deposit Rate Calculator

function calculateMaturityValue() { var principalAmount = parseFloat(document.getElementById("principalAmount").value); var annualInterestRate = parseFloat(document.getElementById("annualInterestRate").value); var depositTermYears = parseFloat(document.getElementById("depositTermYears").value); var compoundingFrequency = parseFloat(document.getElementById("compoundingFrequency").value); var resultDisplay = document.getElementById("result"); resultDisplay.innerHTML = ""; // Clear previous results if (isNaN(principalAmount) || isNaN(annualInterestRate) || isNaN(depositTermYears) || isNaN(compoundingFrequency) || principalAmount <= 0 || annualInterestRate < 0 || depositTermYears <= 0 || compoundingFrequency <= 0) { resultDisplay.innerHTML = "Please enter valid positive numbers for all fields."; return; } var ratePerPeriod = annualInterestRate / 100 / compoundingFrequency; var numberOfPeriods = depositTermYears * compoundingFrequency; // Compound Interest Formula: A = P (1 + r/n)^(nt) // Where: // A = the future value of the investment/loan, including interest // P = the principal investment amount (the initial deposit or loan amount) // r = the annual interest rate (as a decimal) // n = the number of times that interest is compounded per year // t = the number of years the money is invested or borrowed for var maturityValue = principalAmount * Math.pow((1 + ratePerPeriod), numberOfPeriods); var totalInterestEarned = maturityValue – principalAmount; resultDisplay.innerHTML = "Principal Deposit: $" + principalAmount.toFixed(2) + "" + "Annual Interest Rate: " + annualInterestRate.toFixed(2) + "%" + "Deposit Term: " + depositTermYears + " years" + "Compounding Frequency: " + compoundingFrequency + " times per year" + "Estimated Maturity Value: $" + maturityValue.toFixed(2) + "" + "Total Interest Earned: $" + totalInterestEarned.toFixed(2) + ""; } CD Deposit Rate Calculator body { font-family: sans-serif; line-height: 1.6; margin: 20px; } .calculator-container { border: 1px solid #ccc; padding: 20px; border-radius: 8px; max-width: 600px; margin: auto; } .input-group { margin-bottom: 15px; } label { display: block; margin-bottom: 5px; font-weight: bold; } input[type="number"] { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; } 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: 15px; background-color: #e9e9e9; border: 1px solid #ccc; border-radius: 4px; } h2 { text-align: center; margin-bottom: 20px; }

CD Deposit Rate Calculator

function calculateMaturityValue() { var principalAmount = parseFloat(document.getElementById("principalAmount").value); var annualInterestRate = parseFloat(document.getElementById("annualInterestRate").value); var depositTermYears = parseFloat(document.getElementById("depositTermYears").value); var compoundingFrequency = parseFloat(document.getElementById("compoundingFrequency").value); var resultDisplay = document.getElementById("result"); resultDisplay.innerHTML = ""; // Clear previous results if (isNaN(principalAmount) || isNaN(annualInterestRate) || isNaN(depositTermYears) || isNaN(compoundingFrequency) || principalAmount <= 0 || annualInterestRate < 0 || depositTermYears <= 0 || compoundingFrequency <= 0) { resultDisplay.innerHTML = "Please enter valid positive numbers for all fields."; return; } var ratePerPeriod = annualInterestRate / 100 / compoundingFrequency; var numberOfPeriods = depositTermYears * compoundingFrequency; // Compound Interest Formula: A = P (1 + r/n)^(nt) // Where: // A = the future value of the investment/loan, including interest // P = the principal investment amount (the initial deposit or loan amount) // r = the annual interest rate (as a decimal) // n = the number of times that interest is compounded per year // t = the number of years the money is invested or borrowed for var maturityValue = principalAmount * Math.pow((1 + ratePerPeriod), numberOfPeriods); var totalInterestEarned = maturityValue – principalAmount; resultDisplay.innerHTML = "Principal Deposit: $" + principalAmount.toFixed(2) + "" + "Annual Interest Rate: " + annualInterestRate.toFixed(2) + "%" + "Deposit Term: " + depositTermYears + " years" + "Compounding Frequency: " + compoundingFrequency + " times per year" + "Estimated Maturity Value: $" + maturityValue.toFixed(2) + "" + "Total Interest Earned: $" + totalInterestEarned.toFixed(2) + ""; }

Leave a Comment