(week of Feb 23-27)
The purpose of this lab is to practice recursion.
There is only one part in Lab 6. No debug questions in Lab 6.
|
Continue on Question 1, when computing
If exponent is even, then
base exponent =(base exponent/2)2
Improve your program in Question 1 by making use of the fact above.
Write a Java Program , using recursion, compute the sum of all values in an array.
Your program skeleton may look like the one below:
public class DataSet {
public DataSet (int [] anArray) {.....}
public int getSum ( ) { ..... }
....... ....
}