home *** CD-ROM | disk | FTP | other *** search
/ APDL Eductation Resources / APDL Eductation Resources.iso / programs / maths / rpi / !RPI / RPIindex (.txt) < prev   
Encoding:
RISC OS BBC BASIC V Source  |  1995-03-28  |  2.4 KB  |  101 lines

  1.  > RPIindex
  2.  Copyright E.F.Lord 23/9/90
  3.  Modified by David Holden to take RPI from external list March '95
  4. (-3) debug%=
  5.  debug%=
  6. error
  7.  debug% 
  8. debug
  9. question
  10. answer
  11. @%=&0002020A
  12.  rpi(100)
  13.     inf=5
  14. "XOS_File",17,"<RPIindex$Dir>.index" 
  15.  O%,,,,len%
  16.  O%<>1 
  17.  0,"Can't find Index file, unable to continue":
  18.  buff% len%+16
  19. "OS_File",16,"<RPIindex$Dir>.index",buff%,0
  20. "buff%!len%=&0D0D0D0D:I%=buff%:
  21.  I%<buff%+len%
  22.  ?I%=10 
  23.  ?I%=13
  24.     I%+=1
  25. I%=buff%:J%=0
  26. min_year%=
  27. ($I%)
  28. ?I%<>13:I%+=1:
  29. :I%+=1
  30.  rpi(J%)=
  31. ($I%):J%+=1
  32. ?I%<>13:I%+=1:
  33. :I%+=1
  34.  I%>=buff%+len%
  35. max_year%=min_year%-1+J%
  36. debug
  37.  I%=min_year% 
  38.  max_year%
  39.  @%=10:
  40. +% @%=&0002020A:
  41.  rpi(I%-min_year%)
  42. '"Press SPACE to continue":
  43.  K%=32
  44. error
  45. " @ line ";
  46. ;" - Press SPACE to continue"
  47.  K%=32
  48. question
  49. title
  50. 0,y)"Enter 1st year for comparison "year%
  51. dateok
  52. date1$=
  53. (year%)
  54. 0,y+2)"Enter cost of item in ";date1$;
  55.  "price1
  56. 0,y)"Enter 2nd year for comparison "year%
  57. dateok
  58. date2$=
  59. (year%)
  60. dateok
  61.  year%<100 year%+=1900
  62.  (year%<min_year%)
  63. (year%>max_year%):
  64. 40," "):=
  65. answer
  66. title
  67. (date1$):yr2=
  68. (date2$)
  69. N3rpi1=rpi(yr1-min_year%):rpi2=rpi(yr2-min_year%)
  70. price2=price1*rpi2/rpi1
  71. elaps=
  72. (yr2-yr1)
  73. elaps=0
  74. elaps=1
  75. avrpi=
  76. (rpi2-rpi1)/elaps
  77. yr1<yr2 
  78. k=(rpi2/rpi1) 
  79. k=(rpi1/rpi2)
  80. i=(10^(
  81. (k)/elaps)-1)*100
  82. 0,6)"Average Retail Price Index for ";date1$;" is ",rpi1
  83. 0,7)"Average Retail Price Index for ";date2$;" is ",rpi2
  84. 0,9) "RPI  index  multiplier  is      ",k
  85. 0,10)"Inverse RPI index multiplier is ",1/k
  86. 0,12)"Average change in RPI per annum is ",avrpi;" pts"
  87. 0,13)"Average  rate  of  inflation       ",i;" %"
  88. 0,15)"In  ";date1$;"  the  sum  given  was       
  89.   ",price1
  90. 0,17)"giving an equivalent value in ";date2$;" of 
  91.  ",price2
  92. 0,22)"Press RETURN to continue";
  93. title
  94. c    @%=10
  95.  10,820,1260,160
  96.  23,17,7,6,8;16;0;
  97.  420,920
  98. "UK RETAIL PRICES ";min_year%;" - ";max_year%
  99.  PRINTTAB(13,3)"(Rebased 1987)"
  100. @%=&0002020A
  101.