This calculator helps you estimate the potential earnings on a Certificate of Deposit (CD) with Banner Bank, considering various terms and APYs. A CD is a savings product that holds a fixed amount of money for a fixed period of time, in exchange for a fixed interest rate. CDs can be a good option if you want to earn a guaranteed return on your savings and don't need immediate access to the funds.
function calculateCdEarnings() {
var initialDeposit = parseFloat(document.getElementById("initialDeposit").value);
var termInMonths = parseInt(document.getElementById("termInMonths").value);
var annualPercentageYield = parseFloat(document.getElementById("annualPercentageYield").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
if (isNaN(initialDeposit) || isNaN(termInMonths) || isNaN(annualPercentageYield)) {
resultDiv.innerHTML = "Please enter valid numbers for all fields.";
return;
}
if (initialDeposit <= 0 || termInMonths <= 0 || annualPercentageYield < 0) {
resultDiv.innerHTML = "Please enter positive values for deposit and term, and a non-negative APY.";
return;
}
// Convert APY to a monthly rate for calculation
var monthlyInterestRate = (annualPercentageYield / 100) / 12;
// Calculate the final amount using compound interest formula: A = P(1 + r/n)^(nt)
// For monthly compounding, n=12. Here we're calculating for the full term.
var numberOfCompoundingPeriods = termInMonths;
var finalAmount = initialDeposit * Math.pow((1 + monthlyInterestRate), numberOfCompoundingPeriods);
var totalInterestEarned = finalAmount – initialDeposit;
resultDiv.innerHTML =
"