Career, Family And Living For The Lord
-
A Twenty-Five Year History

by James Thomas Lee, Jr. 12/25/97 Copyrighted 1995 by James Thomas Lee, Jr. Copyright Number: XXx xxx-xxx

Appendices

Appendix I. QBASIC Version of FINSYS {913 words}

      INPUT "Enter annual interest rate earned before (xx.x%):"; ai
      ai = ai / 1200

      INPUT "Enter annual interest rate earned after (xx.x%):"; ak
      ak = ak / 1200

      INPUT "Enter annual estmd inflation rate before (xx.x%):"; aj
      aj = aj / 100

      INPUT "Enter annual estmd inflation rate after (xx.x%):"; al
      al = al / 100

      INPUT "Enter your current age (xx):"; ic

      INPUT "Enter your planned retirement age (xx):"; ir

      INPUT "Enter your current savings ($xxxxxxx.xx):"; cs

      PRINT "Enter your monthly disposable income ($xxxxx.xx):"
      INPUT "     recommend using 70% of current salary]"; di

      PRINT "In retirement year dollars,"
      PRINT "     enter other retirement funds ($xxxxx.xx):"
      INPUT "     [i.e., Social Security, Pensions, etc]"; rf

      INPUT "Enter planned number years in retirement (xx):"; iy

REM compute f = (e)(h)(k)

      e = 1 / (1 + ak) ^ (12 * iy - 1)
      h1 = ((1 + ak) ^ 12 - 1) / ak
      k1 = (1 + ak) ^ (12 * iy) - (1 + al) ^ iy
      k2 = (1 + ak) ^ 12 - (1 + al)
      k = k1 / k2
      f = e * h1 * k

REM compute g = (h)(m)

      h2 = ((1 + ai) ^ 12 - 1) / ai
      m1 = (1 + ai) ^ (12 * (ir - ic)) - (1 + aj) ^ (ir - ic)
      m2 = (1 + ai) ^ 12 - (1 + aj)
      m = m1 / m2
      g = h2 * m

REM compute n

      n = cs * (1 + ai) ^ (12 * (ir - ic))

REM compute r

      r1 = (di * (1 + aj) ^ (ir - ic) - rf) * f - n
      r2 = g + e * h1 * k * (1 + aj) ^ (ir - ic)
      r = r1 / r2

      IF (r < 0) THEN r = 0

REM print bms, lo, and ts

      PRINT ""
     
      PRINT ""

      PRINT "Start out saving in the first month:    $";
      PRINT USING "#######.##"; r

      PRINT "Amount left over for you:               $";
      PRINT USING "#######.##"; di - r

      PRINT "Total savings in '";
      PRINT USING "##"; ir - ic;
      PRINT "' years will be:    $";
      PRINT USING "#######.##"; r * g + n

REM open a file for output

      OPEN "fin_data" FOR OUTPUT AS #1
      PRINT #1, "                 RETIREMENT INPUT DATA"

      PRINT #1, "Annual interest rate earned before (xx.x%):           ";
      PRINT #1, USING "##.#"; ai * 1200;
      PRINT #1, " %"

      PRINT #1, "Annual interest rate earned after (xx.x%):            ";
      PRINT #1, USING "##.#"; ak * 1200;
      PRINT #1, " %"

      PRINT #1, "Annual estimated inflation rate before (xx.x%):       ";
      PRINT #1, USING "##.#"; aj * 100;
      PRINT #1, " %"

      PRINT #1, "Annual estimated inflation rate after (xx.x%):        ";
      PRINT #1, USING "##.#"; al * 100;
      PRINT #1, " %"

      PRINT #1, "Your current age (xx):                               "; ic

      PRINT #1, "Your planned retirement age (xx):                    "; ir

      PRINT #1, "Your current savings ($xxxxxxx.xx):             $";
      PRINT #1, USING "#######.##"; cs

      PRINT #1, "Your monthly disposable income ($xxxxx.xx):     $";
      PRINT #1, USING "#######.##"; di

      PRINT #1, "In retirement year dollars, other"
      PRINT #1, "                 retirement funds ($xxxxx.xx):  $";
      PRINT #1, USING "#######.##"; rf

      PRINT #1, "Planned number years in retirement (xx):             "; iy

      PRINT #1, " "
      PRINT #1, "                         OUTPUT RESULTS"

      PRINT #1, "Start out saving in the first month:            $";
      PRINT #1, USING "#######.##"; r

      PRINT #1, "Amount left over for you:                       $";
      PRINT #1, USING "#######.##"; di - r

      PRINT #1, "Total savings in ";
      PRINT #1, USING "##"; ir - ic;
      PRINT #1, " years will be:              $";
      PRINT #1, USING "#######.##"; r * g + n
     
      PRINT #1, " "
     
      PRINT #1, "                         SAVINGS CYCLE"

      PRINT #1, " AGE  BEGINNING SAVINGS  SAVINGS/MONTH  ENDING SAVINGS    LEFT OVER"

      s1 = cs
      s2 = r
      s4 = di - r

      FOR i = ic TO ir - 1
      s3 = s1 * (1 + ai) ^ 12 + s2 * ((1 + ai) ^ 12 - 1) / ai
     
      PRINT #1, "  ";
      PRINT #1, USING "##"; i;
      PRINT #1, "   $";
      PRINT #1, USING "#######.##"; s1;
      PRINT #1, "      $";
      PRINT #1, USING "#######.##"; s2;
      PRINT #1, "     $";
      PRINT #1, USING "#######.##"; s3;
      PRINT #1, "    $";
      PRINT #1, USING "#######.##"; s4
     
      s1 = s3
      s2 = s2 * (1 + aj)
      s4 = s4 * (1 + aj)
      NEXT i

      PRINT #1, ""

      PRINT #1, "                      WITHDRAWAL CYCLE"

      PRINT #1, "       AGE  BEGINNING SAVINGS  WITHDRAWAL/MONTH  ENDING SAVINGS"

REM     if r equals 0, then compute monthly withdrawal (s4) based on
REM     the ending savings balance (s3)

      s4 = s3 / f

      FOR i = ir TO ir + iy - 1
      s3 = s1 * (1 + ak) ^ 12
      s3 = s3 - s4 * (1 + ak) * ((1 + ak) ^ 12 - 1) / ak
     
      PRINT #1, "        ";
      PRINT #1, USING "##"; i;
      PRINT #1, "   $";
      PRINT #1, USING "#######.##"; s1;
      PRINT #1, "      $";
      PRINT #1, USING "#######.##"; s4;
      PRINT #1, "      $";
      PRINT #1, USING "#######.##"; s3

      s1 = s3
      s4 = s4 * (1 + al)
      NEXT i

      PRINT #1, ""
      PRINT #1, ""
      PRINT #1, "NOTE that the monthly retirement pension was not included"
      PRINT #1, "  in the above WITHDRAWAL/MONTH amount.  That pension should be"
      PRINT #1, "  added into the monthly amount to be withdrawn."
      PRINT #1, ""

      CLOSE #1
     
      STOP
      END

Back To The Table Of Contents

Back To TLEE's Home Page

Send email to: tlee6040@aol.com 1