#!/usr/local/bin/perl print "Content-type: text/html\n\n"; $arg = $ENV{'QUERY_STRING'}; if (length($arg) < 3) { print<How much house can you afford?

How much house can you afford?

  • Annual Income
  • Monthly Debt (Car payments, credit cards, student loan payment etc.)
  • Cash in hand for down payment
  • Property tax rate (1% = \$1000/yr for 100K house)
  • Home Insurance rate (0.5% = \$500/yr for 100K house)
  • Interest Rate (%)
  • Length of Loan (years)

    FormInput } else { print<This is what you can afford

    Here are some estimates...


    ResultHead @arga = split("&",$arg); for ($i=0; $i<=$#arga; $i++) { ($key,$val) = split("=",@arga[$i]); $aa{$key} = $val; } $r1 = 28; $r2 = 36; $mi = $aa{"ai"}/12; $c1 = $mi * $r1 / 100; $c2 = ($mi * $r2 / 100) - $aa{"md"}; if ($c1 < $c2) { printf("

    We must use the %2d %% amount of \$%8.2f for PITI

    \n", $r1, $c1); print "
  • This is because this value is lower than the amount "; printf("(\$%8.2f) calculated using the %2d %% monthly debt value\n", $c2, $r2); $piti = $c1; } else { printf("

    We must use the %2d %% amount of \$%8.2f for PITI

    \n", $r2, $c2); print "
  • This is because this value is lower than the amount "; printf("(\$%8.2f) calculated using the %2d %% income only value\n", $c1, $r1); printf("

    To use the lower %2d %% limit, try to keep your monthly", $r1); printf(" debt payments below \$ %8.2f (reduce them by \$ %8.2f)\n", $mi * ($r2 - $r1)/100, $aa{"md"} - $mi * ($r2 - $r1)/100); $piti = $c2; } $j = $aa{"ir"}/1200; $yr = $aa{"yr"}; $amv = (1 - (1 + $j)**(-$yr * 12))/$j; printf("

    Your interest rate of %5.2f %% over $yr years means ",$aa{"ir"}); printf("every dollar you pay each month buys you \$ %7.2f of loan

    ",$amv); $piti_ov = $aa{"hi"} + $aa{"pt"}; printf("

    You stated Tax and Insurance would total %5.2f %% the home value", $piti_ov); print "

    "; $dp = $aa{"dp"}; printf("

    And with \$ %7.2f to cover your down payment

    \n",$dp); print "
    "; $house = 1000; $pmt = $piti; $loan = 1000; for ($i=0; $i<20; $i++) { $ti = $piti_ov/1200 * $house; $loan = ($piti - $ti) * $amv; $house = $loan + $dp; } $dpp = $dp/$house*100; $ltv = ($house-$dp)/$house*100; printf("

  • House value: \$ %7d\n",$house); printf("
  • Loan value: \$ %7d\n",$loan); printf("
  • Monthly Principal+Interest: \$ %7.2f\n",$loan/$amv); printf("
  • Monthly Prop Tax+Insurance: \$ %7.2f\n",$house*$piti_ov/1200); printf("
  • Down Payment %5.2f %%\n",$dpp); printf("
  • Loan To Value (LTV) %5.2f %%
  • \n",$ltv); if ($ltv>80) { print "

    OOPS! Your down payment is less than 20%! You pay PMI

    "; $house = 1000; $pmt = $piti; $loan = 1000; if ($aa{"ty"} =~ /Conv/) { $pmi = .32; if ($ltv>=85) { $pmi = .52; } if ($ltv>=90) { $pmi = .78; } if ($ltv>=95) { $pmi = .90; } if ($ltv>=97) { goto DPTooLowTxt; } } else { $pmi = .5; } printf ("

    That's an extra %4.2f %% of your loan each year

    ",$pmi); $piti_ov += $pmi; for ($i=0; $i<20; $i++) { $ti = $piti_ov/1200 * $house; $loan = ($piti - $ti) * $amv; $house = $loan + $dp; } $dpp = $dp/$house*100; printf("

  • House value: \$ %7d\n",$house); printf("
  • Loan value: \$ %7d\n",$loan); printf("
  • Monthly Principal+Interest: \$ %7.2f\n",$loan/$amv); printf("
  • Monthly Prop Tax+Insurance: \$ %7.2f\n", $house*($piti_ov-0.5)/1200); printf("
  • Monthly PMI: \$ %7.2f\n",$house*$pmi/1200); printf("
  • Down Payment %5.2f %%
  • \n",$dpp); } DPTooLowTxt: if ($dpp<3 && $aa{"ty"} =~ /Conv/ ) { print<

    Hey, your down payment is under 3%

    Many conservative lenders won't do that except on FHA/VA loans. Look around for a lender willing to accept your lower down payment.

    You are relatively income rich but cash poor

    You do not have to worry about your income qualifying you for your loan. What limits your house value is simply your downpayment of \$ $dp: DPTooLow printf("

    With 20%% down (80%% LTV) you can buy a \$ %7d house

    \n",$dp*5); printf("

    With 10%% down (90%% LTV) you can buy a \$ %7d house

    \n",$dp*10); printf("

    With 5%% down (95%% LTV) you can buy a \$ %7d house

    \n",$dp*20); printf("

    With 3%% down (97%% LTV) you can buy a \$ %7d house

    \n",$dp*33.3); print< So look for a lender who is willing to give you a high LTV (loan to value).

    Better yet get more cash for your down payment. Those low or no interest loans from parents, friends and relatives sure come in handy! DPTooLo2 } print "

    Don't forget all those closing costs and points too!

    \n"; print<