Write recursive methods for each of thefollowing tasks. You can place all of you
ID: 3615254 • Letter: W
Question
Write recursive methods for each of thefollowing tasks. You can place all of your methods into a singleJava class. Although these problems are solvable without recursion,use recursion in your solutions for this assignment. The recursivesolutions for these are quite short.
public static double power(double b, inte) This should return the resultwhen b is raised to thee power. Your method should work for any values(positive, negative, or zero) of b ande.
public static String reverse(Strings) This should return a stringcontaining the characters of the string sin reverseorder. Hint: use the substring()and/or charAt()methods ofthe String class to isolate individualcharacters.
public static booleanisPalindrome(String s) This shouldreturn true or falsedependingon whether the string s is apalindrome (i.e., a string that is identical to itsreverse). Do not call your reversemethod! Hint: use thesubstring() and/orcharAt() methods of theString class to isolate individualcharacters.
public static int gcd(int x, inty) This should return the greatest commondivisor (GCD) of the numbers xand y. You can assume thatboth x 0 and y 0. The GCDof two numbers is the largest number that evenly divides bothnumbers. For example, GCD(9,27) = 9 and GCD(21,49) = 7. The GCD canbe computed using the Euclidean algorithm, which says GCD(x,y) = xif y is 0, and GCD(x,y) = GCD(y,remainder of x /y)otherwise.