#!/usr/bin/perl use Number::Format qw(:subs :vars); $THOUSANDS_SEP = ','; $DECIMAL_POINT = '.'; $INT_CURR_SYMBOL = '$'; push(@INC, "/cgi-bin"); use CGI qw(:cgi-lib); &ReadParse(); $initial_amt = $in{init_amt}; $reinvest_amt = $in{inv_amt}; $years = $in{years} + 1; $percent = $in{interest}; $stop_year = $in{stop}; $age = $in{age}; $tax_free = $in{tax_free}; $cntr = 1; $total_invest = 0.0; $total = 0.0; $percent = $percent / 100; print &PrintHeader; printf ""; $total += $initial_amt; $total_invest += $initial_amt; printf ""; for ($cntr = 1; $cntr <= $years; $cntr++) { if ($cntr <= $stop_year) { $total_invest += $reinvest_amt; $total += $reinvest_amt; } $yearly_earnings = ($total * $percent); if ($tax_free == 0) { $taxes = $yearly_earnings * .396; $yearly_earnings -= $taxes; } $total += $yearly_earnings; printf "", $cntr, $age; printf ""; printf ""; printf ""; printf ""; printf ""; $age++; } printf "
YearTotalMy CostYearly InterestTaxesROI
%d(%d)"; printf "%s",format_number($total,'###,###,###.##'); printf ""; printf "%s",format_number($total_invest,'###,###,###.##'); printf ""; printf "%s",format_number($yearly_earnings,'###,###,###.##'); printf ""; printf "%s", format_number($taxes,'###,###,###.##'); printf ""; printf "%s",format_number(($total - $total_invest)/$total_invest*100,'###,###,###.##'); printf "
"; printf " " ;