home *** CD-ROM | disk | FTP | other *** search
/ Between Heaven & Hell 2 / BetweenHeavenHell.cdr / 500 / 481 / invhisto.bas < prev    next >
BASIC Source File  |  1986-08-08  |  2KB  |  51 lines

  1. 100 'Investment History ("INVHISTORY")
  2. 110 CLS
  3. 120 COLOR 0,15 : PRINT "Investment History" : COLOR 15,0
  4. 130 DEFDBL A-Z
  5. 140 DEFINT M-N, Y
  6. 150 'Templates for printing numbers
  7. 160 PCTFMT$ = "###.##_%"
  8. 170 MONEYFMT$ = "$$##,###,###.##"
  9. 180 '     Let user enter data
  10. 190 PRINT
  11. 200 PRINT "Do not enter dollar signs or commas"
  12. 210 PRINT
  13. 220 INPUT "Purchase price: ", PV
  14. 230 INPUT "Term (in years): ", NYEARS
  15. 240 INPUT "Annual income (as percent of purchase price): ", RINCOME
  16. 250 INPUT "Annual capital gains (in percent): ", RCGAINS
  17. 260 INPUT "Annual interest rate on savings (in percent): ", AR
  18. 270 INPUT "Number of years to start of income stream : ", NDELAY
  19. 280 '     Convert percent rate to decimal
  20. 290 RINCOME = RINCOME / 100
  21. 300 RCGAINS = RCGAINS / 100
  22. 310 AR = AR / 100
  23. 320 PRINT
  24. 330 PRINT "Press space bar to see next year's results"
  25. 340 PRINT
  26. 350 '     Initialize values
  27. 360 TOTALINCOME = 0
  28. 370 PRICE = PV
  29. 380 '      Calculate each year's values
  30. 390 FOR YEAR = 1 TO NYEARS
  31. 400   'Wait for user to press key
  32. 410   WHILE INKEY$ = "" : WEND
  33. 420   PRICE = PRICE * (1 + RCGAINS)
  34. 430   TOTALINCOME = TOTALINCOME * (1 + AR)
  35. 440   IF YEAR > NDELAY  THEN TOTALINCOME = TOTALINCOME + PV * RINCOME
  36. 450   CAPITALGAINS = PRICE - PV
  37. 460   ANNUALYIELD = ( (PRICE + TOTALINCOME) / PV) ^ (1 / YEAR) - 1
  38. 470   ANNUALYIELD = 100 * ANNUALYIELD
  39. 480   'Print results
  40. 490   PRINT
  41. 500   PRINT "Year: "; YEAR
  42. 510   PRINT "Current price of investment: "; TAB(32);
  43. 520   PRINT USING MONEYFMT$; PRICE
  44. 530   PRINT "Capital gains: ";TAB(32); 
  45. 540   PRINT USING MONEYFMT$; CAPITALGAINS
  46. 550   PRINT "Total income: "; TAB(32);
  47. 560   PRINT USING MONEYFMT$; TOTALINCOME
  48. 570   PRINT "Rate of return: "; TAB(41); USING PCTFMT$; ANNUALYIELD
  49. 580 NEXT YEAR
  50. 590 END
  51.