Question: import recursion.Recursion; // Uncomment this block of code to test Activity 4 /* System.out.println( Activity 4:); // Test factorial System.out.println(Factorial:); for (int ii = 1;

 import recursion.Recursion; // Uncomment this block of code to test Activity

import recursion.Recursion;
// Uncomment this block of code to test Activity 4
/*
System.out.println(" Activity 4:");
// Test factorial
System.out.println("Factorial:");
for (int ii = 1; ii
System.out.print(Recursion.fact(ii) + " ");
}
// Test fibonacci
System.out.println(" Fibonacci:");
for (int ii = 1; ii
System.out.print(Recursion.fib(ii) + " ");
}
// Test Euclid's GCD algorithm
System.out.println(" GCD:");
System.out.println ("GCD of 96 and 60 is " + Recursion.gcd(96, 60));
System.out.println ("GCD of 30 and 10 is " + Recursion.gcd(30, 10));
System.out.println ("GCD of 96 and 120 is " + Recursion.gcd(96, 120));
// Uncomment out this block of code to test Project 4
System.out.println(" Test Project 4:");
System.out.println("Power:");
for (int ii = 1; ii
for (int jj = 0; jj
System.out.print(ii + "^" + jj + "=" + Recursion.power(ii,jj) + " ");
}
System.out.println();
}
*/

1) Download the source code from https:/lgithub.com/CGCC-CS/205activity4.git. The source code has a driver class called Activity4.java that calls the methods below. Uncomment the test code. Your recursive methods should work with the test driver without making any changes. 2) Write a recursive Java method fact (n) to find n! 3) Write a recursive Java method fib (n) that finds the nth Fibonacci number 4) Write a recursive method that gcd (num1, num2) implements the GCD algorithm defined below. You should not implement any other GCD algorithm. gcd(num1, num2) = num2 if num2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!