#!/usr/local/bin/perl # $args = $ENV{'QUERY_STRING'}; if (length($args) < 3) { print< Convertible Balloon Mortgage Calculator

Convertible Balloon Mortgage Calculator

These days 5/25 and 7/23 convertible balloon mortgages are becoming more popular because they provide lower rates than conventional 30 year mortgages while providing a fixed payment schedule for 5 or more years. The risk, of course, is what happens after the initial fixed period is over and you have the possibility of converting your loan.

Here is a calculator to try to answer those questions...

Principal Balance
Type of Loan
Initial Interest (%)
Monthly Pre-payment during
initial fixed period
Output type

EOF } else { @v = split("&",$args); $tbl = "N"; for ($i=0; $i<=$#v; $i++) { ($key,$val) = split("=",@v[$i]); $aa{$key} = $val; if (($key =~ "out") && ($val =~ /HTML/)) { $tbl = "Y"; } } $bal = $aa{"bal"}; $init = substr($aa{"fxd"},0,1); if ($init eq "1") { $init = 10; } $int = $aa{"int"}; $prepay = $aa{"prepay"}; $tt = $init * 12; $ir = $int / 1200; $temp = (1 + $ir) ** -360; $paymt = ($bal * $ir) / (1 - $temp); print "Content-type: text/html\n\n"; print "Monthly Payment Table\n"; print "
\n"; print "

Convertible Balloon Mortgage Calculator Results

"; printf ("

Your Monthly Payment for %2d Years will be \$ %9.2f

", $init, $paymt); if ($prepay > 0) { printf("

Plus \$ %7.2f monthly prepayment for \$ %7.2f total

\n", $prepay,$paymt+$prepay); } print "

Amortization Table for First $init Years

"; if ($tbl eq "Y") { print "
\n"; } else { print "
\n  YR  Start Bal        Int       End Bal      \n"; 
   print "  ==  ==========  ==========  =========\n";
  }
  for ($i=1; $i<=$init; $i++)
  {
     $sbal = $bal; $ti = 0;
     for ($j=0; $j<12; $j++) # each month
     {
       $ci = $bal * $ir; $bal += $ci - $paymt - $prepay; $ti += $ci;
     }
     if ($tbl eq "Y")
     {
       printf("
\n",$i,$sbal,$ti,$bal); } else { printf(" %2d %10.2f %10.2f %10.2f\n",$i,$sbal,$ti,$bal); } } if ($tbl eq "Y") { print "
YrStart BalIntEnd Bal
%2d%10.2f%10.2f%10.2f
\n"; } else { print "\n
\n"; } printf("

After %2d Years Your Balance will be \$ %9.2f

", $init, $bal); $rest = 30 - $init; print "

Let's see what happens in the next $rest years

\n"; if ($tbl eq "Y") { print "\n"; print "\n"; } else { print "
\n   Rate      Payment   Tot Int  ";
   print                 "   Rate      Payment   Tot Int\n";
   print                 "  ======  ==========  =========  ";
   print                 "  ======  ==========  =========\n";
  }
  for ($fi = 4; $fi <= 8; $fi += .25)
  {
    $ir = $fi/1200; $fi2 = $fi + 4;
    $temp = (1 + $ir) ** -($rest * 12);
    $np = ($bal * $ir) / (1 - $temp);
    $ti = ($rest * 12 * $np) - $bal;

    $ir2 = $fi2/1200;
    $temp = (1 + $ir2) ** -($rest * 12);
    $np2 = ($bal * $ir2) / (1 - $temp);
    $ti2 = ($rest * 12 * $np2) - $bal;
    if ($tbl eq "Y") 
    { printf("
\n",$fi,$np,$ti); printf("\n",$fi2,$np2,$ti2); } else { printf(" %6.2f %9.2f %9.2f ",$fi,$np,$ti); printf(" %6.2f %9.2f %9.2f\n",$fi2,$np2,$ti2); } } if ($tbl eq "Y") { print "
RatePaymentTot IntRatePaymentTot Int
%6.2f%9.2f%9.2f%6.2f%9.2f%9.2f
\n"; } else { print "\n\n"; } print<This shows what your new monthly payment will be as well as the total interest you will pay for the next $rest years depending what your new interest rate will be. Trailer }