home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / compiler / sample3.bas < prev    next >
BASIC Source File  |  1993-06-20  |  4KB  |  158 lines

  1.  
  2.  
  3.  
  4. rem
  5. rem This program is a standard Basic program which does not utilize
  6. rem mouse, buttons, etc.  It shows how you can make Basic programs
  7. rem designed to run under DOS, run under DOS or Windows with few, if
  8. rem any, modifications.
  9. rem
  10. rem program prompts for $ amount, interest rate, and tax bracket.
  11. rem
  12. rem It displays before/after tax income for selected years.
  13. rem
  14.  
  15.  
  16. rem
  17. rem The following  WINDOWS SIZE command is optional.  This program will
  18. rem run in DOS and Windows without this command.  This command allows you
  19. rem to put items centered on DOS's 80x25 screen in a smaller window when
  20. rem running under Windows.
  21. rem You would do this if the DOS screen had columns on the left and/or
  22. rem rows on the top which were not used.  This lets you have a smaller
  23. rem window in Windows. 
  24.  
  25.     rem   WINDOWS SIZE 13,3,72,22
  26.  
  27.  
  28. rem
  29. rem The following WINDOWS NAME command is optional.  It allows you to
  30. rem specify the name to appear as window name when run under Windows.
  31. rem The default window name is the name of the file compiled.  This
  32. rem command is ignored in DOS mode.
  33. rem
  34.  
  35.     REM windows name "Investment Analysis"
  36.  
  37.  
  38.  
  39. color 7,1
  40. cls
  41.  
  42.  
  43.  
  44.    color 1,6
  45.    locate 3,22:print "Before/After tax investment analysis";
  46.    color 7,1
  47.    locate 5,22:print "Enter desired values and press Enter";
  48.    if ostype<>2 then
  49.      locate 6,22:print "    (Enter -9 to exit program)";
  50.   end if
  51.  
  52.    color 1,6
  53.    for y=12 to 21
  54.      locate y,15
  55.      print space$(50);
  56.    next y
  57.    locate 12,32:print "ACCOUNT BALANCE";
  58.    locate 14,29:print " Tax Free";
  59.    locate 14,49:print " Taxable";
  60.    locate 16,20:print "Year 1";
  61.    locate 18,20:print "Year 5";
  62.    locate 20,20:print "year 10";
  63.    color 7,1
  64.    di=6
  65.    dt=15
  66.    da=600
  67.  
  68. 100
  69.  
  70.    rem
  71.    rem get interest rate
  72.    rem
  73.    locate 8,20
  74.    print using "Enter Annual Interest Rate(##.##%):           ";di;
  75.    locate 8,56
  76.    input "",i
  77.    if i=-9 then stop
  78.    if i=0 then i=di else di=i
  79.    gosub doprojections
  80.  
  81.  
  82.    rem
  83.    rem get tax bracket
  84.    rem
  85.  
  86.    locate 9,20
  87.    print using "Enter Tax Bracket (##.##%):           ";dt;
  88.    locate 9,48
  89.    input "",t
  90.    if t=-9 then stop
  91.    if t=0 then t=dt else dt=t
  92.    gosub doprojections
  93.  
  94.  
  95.    rem
  96.    rem get investment amount
  97.    rem
  98.  
  99.    locate 10,20
  100.    print using "Enter Annual amount to invest ($##,###.##):             ";da;
  101.    locate 10,64
  102.    input "",a
  103.    if a=-9 then stop
  104.    if a=0 then a=da else da=a
  105.    gosub doprojections
  106.  
  107.    goto 100
  108.  
  109.  
  110.  
  111. rem
  112. rem calculation section which tells what we would have in the future
  113. rem
  114.  
  115. doprojections:
  116.  
  117.    color 1,6
  118.  
  119.    rem
  120.    rem calculate after tax contribution
  121.    rem
  122.        ba=(1-(dt/100))*da
  123.  
  124.    rem
  125.    rem calculate before tax effective interest earned
  126.    rem
  127.        bi=(1-(dt/100))*di
  128.  
  129.    rem
  130.    rem after year 1
  131.    rem
  132.  
  133.        before1=da*(1+di/100)
  134.        after1=ba*(1+bi/100)
  135.  
  136.    locate 16,30:print using "###,###.##";before1;
  137.    locate 16,50:print using "###,###.##";after1;
  138.  
  139.       for ii%=1 to 4
  140.          before1=(before1*(1+di/100))+(da*(1+di/100))
  141.          after1= (after1*(1+bi/100))+(ba*(1+bi/100))
  142.       next ii%
  143.  
  144.    locate 18,30:print using "###,###.##";before1;
  145.    locate 18,50:print using "###,###.##";after1;
  146.  
  147.  
  148.       for ii%=1 to 5
  149.          before1=(before1*(1+di/100))+(da*(1+di/100))
  150.          after1= (after1*(1+bi/100))+(ba*(1+bi/100))
  151.       next ii%
  152.  
  153.    locate 20,30:print using "###,###.##";before1;
  154.    locate 20,50:print using "###,###.##";after1;
  155.    color 7,1
  156.    return
  157.  
  158.