Re: Various Interest Rates
- From: "shannon" <shannondingle@xxxxxxxxxxxxx>
- Date: 31 Jan 2006 13:49:11 -0800
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
.
- Follow-Ups:
- Re: Various Interest Rates
- From: Rajah
- Re: Various Interest Rates
- References:
- Various Interest Rates
- From: shannon
- Re: Various Interest Rates
- From: mikm
- Various Interest Rates
- Prev by Date: Re: String replaceAll doesn't like commas
- Next by Date: Re: signum of long
- Previous by thread: Re: Various Interest Rates
- Next by thread: Re: Various Interest Rates
- Index(es):
Relevant Pages
|