hey guys what's up?

I was trying to solve a problem that I met in my book Java how to program it's about compound interests.

Code :

public class Interests { public static void main (String[] args) { double p = 1000; double rate = 0.05; double amount; for (int year = 1; year <= 10; year++){ amount = p * (Math.pow((1+rate),years)); System.out.printf("the amount for year %d is: %,20.2f", year, amount); }//end for }//end main }//end class

this was the original code.THE QUESTION IS:Modify the application to use only integers

to calculate the compound interest. [Hint: Treat all monetary amounts as integral numbers

of pennies. Then break the result into its dollars and cents portions by using the division and remainder

operations, respectively. Insert a period between the dollars and the cents portions.]

THE PROBLEM IS:it's ok to treat all monetary amounts as integral numbers of pennies then break the result into dollars and cents, but how can I convert the rate to an integer without losing data ?