I have the following code :
double getTotalPayments(){
for (int i = 0 ; i == periodsPerYear * years ; i++){
double balance =+ Math.round(initialBalance - (monthlyPayment-((interestRate/periodsPerYear) *initialBalance))*100.00)/100.00;
initialBalance =- balance;
if(i == periodsPerYear*years){
return balance;
break;
}
}
return balance;
}
I'm trying to pass the double variable 'balance' for the method to return. I have to use the for loop to calculate the total amount of payments. Any suggestions on how to fix it? I've tired everything I can think of.