Modify the compound-interest program of to repeat its steps for interest rates of 5%, 6%, 7%, 8%, 9%, and 10%. Use a for loop to vary the interest rate. I'm doing something wrong, just don't know what. Any help is appreciated.

public class p416

{

public static void main( String args[] )

{

double amount; // amount on deposit at end of each year

double principal = 1000.0; // initial amount before interest

for ( int rate = 5; rate <= 10; rate++ )

{

// display headers

System.out.printf( "%s%20s\n", "Year", "Amount on deposit" );

// calculate amount on deposit for each of ten years

for ( int year = 1; year <= 10; year++ )

{

// calculate new amount for specified year

amount = principal * Math.pow(1 + (rate / 100), year );

// display the year and the amount

System.out.printf( "%4d%,20.2f\n", year, amount );

} // end for

}

} // end main

} // end class Interest