Mega Code Archive

 
Categories / Flash ActionScript / Development
 

The calculation for finding compound interest

cp is the number of compounding periods per year (12 if it is compounded every month) t is the number of years.  package{   import flash.display.Sprite;      public class Main extends Sprite{     public function Main(){         var nOrig: int = 10;         var nRate:int = 2;         var nCp: int = 3;         var nT: int = 3;                  var nNew = nOrig * Math.pow((1 + nRate/nCp), (nCp*nT));         trace(nNew);     }   } }