about | help | code help+videos | done | prefs |
You have a bank account which begins with P dollars (P>0) and has a nominal yearly interest rate (aka APR) of r. Notice that we didn't say "r percent" here so you should assume 0<r<1. Suppose your money is compounded several times per year, so that in reality you'll have more than P*(1+r) at the end of a year (the true rate of interest you're being paid is the APY). Write a function compoundInterestAmount(P,r,y,dt) which computes the amount of money you'll have after y years, where compounding happens once in each interval of length dt. Your function should return the integer part of the number it computes. compoundInterestAmount(100, 0.05, 1, 0.1) → 105 compoundInterestAmount(1000, 0.05, 1, 0.1) → 1051 compoundInterestAmount(1000, 0.03, 7, 1) → 1229 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy