Question
Can this be done in java and be clear to understand please. Thank you. Write the class RecursiveProbs, with the methods listed below. Write all
Can this be done in java and be clear to understand please. Thank you.
Write the class RecursiveProbs, with the methods listed below. Write all the methods using recursion, not loops. You may use JDK String methods like substring() and length(), but do not use the JDK methods to avoid coding the algorithms assigned. For example, don't use String.reverse(). public boolean recursiveContains(char c, String s) returns true if the String contains the char, otherwise returns false. Here is the code for this method, which you should use as an example to see how to write the remaining methods: public boolean recursiveContains(char c, String s){ if(s.length() == 0) return false; if(s.charAt(s.length()-1)==c) return true; else return recursiveContains(c, s.substring(0, s.length() -1)); } public boolean recursiveAllCharactersSame(String s) returns true if all the characters in the String are identical, otherwise false. If the String has length less than 2, all the characters are identical. public String recursiveHead(int n, String s) returns the substring of s beginning with the first character and ending with the character at n - 1; in other words, it returns the first n characters of the String. Return empty String ("") in cases in which n is zero or negative or exceeds the length of s.
Write JUnit tests that are sufficient to show that the above methods (the ones you wrote, not the sample one) work correctly.
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