Children's savings calculator - invest your child benefit
Saving for children can be easier than you think. If you can afford to invest the Child Benefit paid out for each child, you may be surprised to see how that can grow into a healthy lump sum over time.
function update(){ var numYears = document.getElementById('numYears').value; var numPeriodsPerYear = 12; var interestRate = document.getElementById('interestRate').value; var depositAmount = document.getElementById('depositAmount').value; var totalBalance = 0; // validate input if (!isValidNum(numYears)){ numYears = 0; } if (!isValidNum(numPeriodsPerYear)){ numPeriodsPerYear = 0; } if (!isValidNum(interestRate)){ interestRate = 0; }else if (interestRate != 0){ interestRate = (interestRate / 100); } if (!isValidNum(depositAmount)){ depositAmount = 0; } // check interest rate is specified so balance can grow if (interestRate != 0){ var interestRatePerPeriod = (1+ (interestRate / numPeriodsPerYear)); var totalNumPeriods = (numYears * numPeriodsPerYear); var growthRate = (Math.pow(interestRatePerPeriod,totalNumPeriods) - 1); var numPeriodsPerInterestPercent = (numPeriodsPerYear / interestRate); totalBalance = depositAmount * growthRate * numPeriodsPerInterestPercent; totalBalance = totalBalance; }else{ // balance won't grow without interest totalBalance = (depositAmount*(numYears * numPeriodsPerYear)); } document.getElementById('total').value = formatTo(totalBalance,2); }