Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please make sure the code works before submitting your answer. Follow all instru

ID: 3677431 • Letter: P

Question

Please make sure the code works before submitting your answer. Follow all instructions listed above as well. Thankyou

1. (20 marks, Recursion.java) Write a java program that has three static recursive methods and a main method. In your main method (5 marks) prompt for user input and display the results of each of your recursive methods as shown in the sample output below. (a) (5 marks) Write a method that uses recursion to compute the value of a", where a and n are both arguments to the method. If n 0, the method should return 1 as a 1. If n 1, the method should return aa a a. If n is any other number that's for you to determine but remember, an-a × an-1 (b) (5 marks) Write a method that uses recursion to return the reverse of a String that is passed to the method as an argument. Hint: For base cases, consider a string that has 1 or fewer characters... how much work is there to reverse them? Otherwise a reversed string is the last letter of the original string plus the reverse of the rest. Try it out on paper first. (c) (5 marks) Write a recursive method that determines the number of digits in an integer, n. Hint: If n

Explanation / Answer

b)