Solver Retirement Income Calculator
Algebra
->
Finance
-> Solver Retirement Income Calculator
Log On
Algebra in Finance
Algebra
Solvers
Solvers
Lessons
Lessons
Answers archive
Answers
Source code of 'Retirement Income Calculator'
This Solver (Retirement Income Calculator)
was created by by
PrateekJain(0)
:
View Source
,
Show
,
Put on YOUR site
About PrateekJain
:
==section input Please enter the following: Present Age: *[input age=40] years Retirement Age: *[input r=55] years Income requirement per year (in current terms): $ *[input inc=50000] Number of years after retirement: *[input ar=5] years Inflation: *[input inf=3]% Expected Interest rate: *[input ir=4.5]% ==section solution perl $s = $r - $age; $e = $s + $ar; $with = 0; $bb=0; $i=0; $eb=0; $tablep = "<table width=80%><tr><td><b>Year</b></td> <td><b>Beginning Balance</b></td> <td><b>Withdraw</b></td> <td><b>Interest</b></td> <td><b>End Balance</b></td></tr>"; $tableend = "</table>"; for ($count = $e-1; $count >= $s; $count--) { $with = $inc * ((1 + $inf/100)** $count); $bb = $with + $eb/(1+$ir/100); $i = ($bb - $with)*($ir/100); $eb = $bb; $with1 = int($with); $bb1 = int($bb); $i1 = int($i); $year = $count + 1 - $s; $tableend ="<tr><td>$year</td> <td>$bb1</td> <td>$with1</td> <td>$i1</td> <td>$eb1</td> </tr>".$tableend; $eb1 = int($eb); } $table = $tablep.$tableend; print $table; ==section output bb1 ==section check age=40 r=55 inc=50000 ar=5 inf=3 ir=4.5 bb1=378469