public static double calculateFinalCapital(double initialCapital, int years, double interestRate, double yearlyRate) {
double finalCapital;
if(years < 0)
{
return initialCapital;
}
else
return calculateFinalCapital(initialCapital, years-1 ,interestRate ,yearlyRate)*(interestRate+1);
}
Hey everyone, I'm having trouble getting the correct balance to show up :/
initialCapital is the starting capital
years is the runtime (in years)
interestRate is the rate of interest
yearlyRate is the yearly rate