Some problems with formulas. RRS feed

  • Question

  • I would like to do the following formula in Small Basic

    P = C (1 + r/n)<sup> nt</sup>
        P = future value
        C = initial deposit
        r = interest rate (expressed as a fraction: eg. 0.06)
        n = # of times per year interest in compounded
        t = number of years invested

    I wrote the followin but it does not seem to work.

    • 'Compund Interest Calculator
      TextWindow.Title = ("Compound Interest Calculator")
      ' initialize variables
      c = 0
      R = 0
      N = 0
      T = 0
      ' ask what the Initial Deposit is
      TextWindow.Write("What is your initial Deposit")
      C = TextWindow.Read()
      'Ask the interest rate
      TextWindow.Write("What is your interest rate? Expressed as a Fraction EG 0.06 for six percent.")
      r = TextWindow.Read()
      'Ask how many times a year interest is charged
      TextWindow.Write("How many times a year is interest charged?")
      n = TextWindow.Read()
      'For how many years is the funds invested
      TextWindow.Write("For how many years is the finds invested")
      t = TextWindow.Read()
      P = C*( 1 + )(r / n))Math.Power(n*t)

    Any help would be appreciated.

    Thursday, February 13, 2014 2:33 PM


  • If you change the last line into:

    P = C*Math.Power(1 +(r / n),n*t)
    it works. Furthermore it is better to insert a space after the ? in your textwindow.writes. It looks better.

    Jan [ WhTurner ] The Netherlands

    • Marked as answer by Neil.Pta Thursday, February 13, 2014 3:24 PM
    Thursday, February 13, 2014 2:56 PM