diff --git a/calc.html b/calc.html index d7a20b8..0216318 100644 --- a/calc.html +++ b/calc.html @@ -77,7 +77,7 @@ - @@ -210,7 +210,7 @@ /* --- Read raw inputs --- */ var a=parseFloat(document.getElementById('scd-amt').value), /* Investment amount (£) */ r=parseFloat(document.getElementById('scd-rate').value), /* Annual interest rate (%) */ - t=parseInt(document.getElementById('scd-term').value), /* Bond term (years) */ + t=parseInt(document.getElementById('scd-term').value,10), /* Bond term (years) */ mEl=document.querySelector('input[name="scd-m"]:checked'), /* Selected payout method */ m=mEl?mEl.value:'cm', /* Default to compound-at-maturity */ e=document.getElementById('scd-err'), /* Error container */ @@ -245,7 +245,7 @@ if(ann){ p=i; /* yearly payout = this year's interest */ }else if(y===t){ /* final year for at-maturity modes */ - p=cmp?bal+i:bal+i; /* pay out current balance + final interest */ + p=cmp?bal+i:a+totI; /* cm: full accumulated balance; sm: principal + total simple interest */ } totP+=p; @@ -281,7 +281,7 @@ /* --- Populate summary cards --- */ document.getElementById('scd-r-total').textContent=g(total); document.getElementById('scd-r-interest').textContent=g(netI); - document.getElementById('scd-r-annual').textContent=(ann?'':'~')+g(yrInc)+(ann?'/yr':'/yr avg'); + document.getElementById('scd-r-annual').textContent=g(yrInc)+(ann?'/yr':'/yr avg'); document.getElementById('scd-r-eff').textContent=eff.toFixed(2)+'%'; /* --- Update security tier display --- */