Re: Various Interest Rates



The for loop below seems to be working for me, at the moment. I have
the interest rates at full numbers eg 5, 6 etc. but i need to change
them to 0.05, 0.06 but not sure how to go about this. Think it might be
something to do with precision?


// calculate amount of deposit for each of ten years
for ( int year = 1; year <= 10; year ++ ) {

//calculate interest rates
for ( int rate = 5; rate <=10; rate ++) {

// calculate new amount for specified year
amount = principal * Math.pow( 1.0 + rate, year );

// append one line of text to outputTextAea
outputTextArea.append( year + "\t" + moneyFormat.format( amount
) + "\t" + moneyFormat.format( amount )
+ "\t" + moneyFormat.format( amount ) + "\t" +
moneyFormat.format( amount ) + "\t" + moneyFormat.format( amount ) +
"\t" + moneyFormat.format( amount ) + "\n" );

}// end for
} //end for

.



Relevant Pages

  • Read Text File
    ... amount of lines and then right that data to another file. ... MsgBox (rs1) ... Prev by Date: ...
    (microsoft.public.scripting.vbscript)
  • Re: Various Interest Rates
    ... shannon wrote: ... > The for loop below seems to be working for me, ... > // calculate amount of deposit for each of ten years ...
    (comp.lang.java.programmer)
  • Re: 200% BONUS to $200
    ... you get a 200% bonus on any amount you deposit. ... Prev by Date: ...
    (rec.gambling.poker)
  • Re: Threading a server
    ... SMTP. ... needed the watchdog and with a reasonable amount of time. ... I am guessing that to deal with the timeout behaviour, ... The next message you posted commented on the loop. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: processing a sequence
    ... (loop for sublist = (collect-sublist) ... return accum if not element = list.first ... if prev and element < prev ... James still didn?t show his Ruby one-liner that outperforms the Lisp ...
    (comp.lang.lisp)