100 factorial
|initialAmount sep|
initialAmount := 100 asFixedPoint:2.
sep := '+---+'.
1 to:20 do:[:year | sep := sep , '-------+'].
Transcript showCR:sep.
sep := '| |'.
1 to:20 do:[:year | sep := sep , ' %1 |' bindWith:(year printStringLeftPaddedTo:2)].
Transcript showCR:sep.
sep := '+---+'.
1 to:20 do:[:year | sep := sep , '-------+'].
Transcript showCR:sep.
#(0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.20) do:[:percentF |
|percent|
percent := percentF asFixedPoint:2.
Transcript show: '|'.
Transcript show: ((percent * 100) asInteger printStringLeftPaddedTo:2); show: '%'.
Transcript show: '|'.
1 to:20 do:[:years |
|amount|
amount := initialAmount * ((1 + percent) raisedTo:years).
Transcript show: (amount printStringLeftPaddedTo:7).
Transcript show: '|'.
].
Transcript cr.
Transcript showCR:sep.
].
BTW, this should tell you, why you should never lend money for more than a (say) 7% interest rate,
and that CEOs promising a continued return on capital of 20% over many years are criminal liars ;-)
... I will add some of my secrets here soon ...
Copyright © Claus Gittinger Development & Consulting
Copyright © eXept Software AG
<cg at exept.de>