Question
this is java problem. class named RecursionExamples with a number of empty methods corresponding to the 5 recursive methods described below. A main is provided
this is java problem. class named RecursionExamples with a number of empty methods corresponding to the 5 recursive methods described below. A main is provided for testing.
----------------------------------------------------------------------
public class RecursionExamples {
public static void main(String[] args) {
}
public static double sumSeries(int n) {
return 0.0;
// *** WRITE CODE HERE ***
}
public static void printReverse(String s, int n) {
// *** WRITE CODE HERE ***
}
public static void printReverse2(String s, int n) {
// *** WRITE CODE HERE ***
}
private static void printReverse2(String s, int n, int loc) {
// *** WRITE CODE HERE ***
}
public static int countDigits(String s, int low, int high) {
return 0;
// *** WRITE CODE HERE ***, can use helper, or not
}
public static int countCode(String msg, String code ) {
return 0;
// *** WRITE CODE HERE ***
}
private static int countCode(String msg, String code, int pos ) {
return 0;
// *** WRITE CODE HERE ***
}
}
a. Write a recursive method with this signature: public static double sumSeries(int n) that returns the sum of the series: 1 2 1 1 +--?i...-?, if i is even-, b. Write a recursive method with this signature (do not use a helper method): public static void printReverse (String s, int n) that prints tuples of size n from the string in reverse. Examples: Input' "3412",2 ("789456123".3)-- "7456123",3 ("abcdefghijklmnopqrstuvwxyz",10) Output 1234 123456789-+ 1234567+ qrstu hijklmnopabcdef* c. Write a method with this signature pub is static void printReverse2(String s, int n) {4 that utilizes this recursive helper method
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started