The project is to write a recursive method that prints the parameters and return along each step.
Here’s what I have so far:
public static int summation(int lower, int upper){
if (lower > upper)
return 0;
else{
System.out.println("Current lower bound: " + lower);
System.out.println("Upper bound: " + upper);
return lower + summation(lower+1, upper);
}
Its almost perfect, the only thing it’s missing is printing the return every time. How do make it do that?
How about this: