Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a recursive method that will do the following: It should accept two strings. The first string will be longer than the second string. It
- Write a recursive method that will do the following:
- It should accept two strings. The first string will be longer than the second string. It should return a string that is equal to the first string with all instances of the second string removed.
Example: If the method receives Mississippi and iss then it should return Mippi, which is Mississippi with all occurrences of iss removed.M
If the method receives disfunctional and fun, it will return disctional.
If the second string is not inside the first string, then the method will just return the first string.
- Your recursive method should not have a loop inside it. It should rely on the recursion to do the looping.
- Write a program to test your method (and make sure you test it with more than one set of data. There is no telling how many times the second string may be found in the first string.)
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