CMPINF 401 LAB #7 TRACING RECURSION


Here is a brief explanation of RECURSION

At the bottom of the page is an image of a program listing that compiles and executes correctly. The main method calls seven methods named mystery1() through mystery7(). These seven methods use recursion to do some task. You job is to read the code and tell what the output of each method is and also describe what that operation that output represents. Your answers will be HUMAN GRADED by your UTAs. For obvious reasons they cannot be auto graded since the answers are in english sentences.

For example if the method adds up all the numbers in an array and divides the sum by the number of elements (i.e. computes the average) You would be expected to write two things:
(1) output=25.2 (2) AVERAGE OF THE ARRAY VALUES

Each answer must be a two part answer: (1) the actual output value (2) very brief description that shows you understood the MEANING of the code

YOU ARE NOT ALLOWED TO TYPE THIS CODE INTO A JAVA FILE OR COMPILE/EXECUTE IT. TRACE IT IN YOUR HEAD OR ON PAPER

Your answers must be typed into a file named Lab7.java
Here is a template you can fill in: Lab7.java <= use this
The entire contents of the file is commented out just like we did for the midterm answer file.

You must write the actual outputted answer AND a description of what it does.

/*
MYSTERY #1:  (1) output=3.14159		(2) ITS THE DIGITS OF PI
MYSTERY #2   (1) output=11.8769		(2) PRODUCT OF THE SQUARE ROOTS OF EACH DIGIT
MYSTERY #3   (1) output=?????		(2) ????
...
MYSTERY #7   ....
*/