public class Interest{ double interest(double rate, double amount){ return amount+(amount*rate); } double totalSaving(int months,double monthly,double rate){ double yearly=rate/12; for(int i=1;i<=months;i++){ System.out.print(\"After Month \"+i+\" Amount \"); monthly=interest(yearly,monthly); System.out.println(monthly); } } public static void main(String [] args){ Interest i=new Interest(); i.totalSaving(12,100,0.5) } } Solution public class Interest{ double interest(double rate, double amount){ return amount+(amount*rate); } double totalSaving(int months,double monthly,double rate){ double yearly=rate/12; for(int i=1;i<=months;i++){ System.out.print(\"After Month \"+i+\" Amount \"); monthly=interest(yearly,monthly); System.out.println(monthly); } } public static void main(String [] args){ Interest i=new Interest(); i.totalSaving(12,100,0.5) } }.