Create a class Recursion. It will have two static methods: removeX and countSubstring and write each function recursively. Recursion class removeX The removeX function will take a String as a parameter. It will return a new String that is the same as the original String, but with all “x” characters removed. This method will be case insensitive.   countSubstring The countSubstring function will take two strings as parameters and will return an integer that is the count of how many times the substring (the second parameter) appears in the first string without overlapping with itself. This method will be case insensitive.   For example: countSubstring(“catwoman loves cats”, “cat”) would return 2 countSubstring(“aaa nice”, “aa”) would return 1 because “aa” only appears once without overlapping itself. Create a Main class to test and run your Recursion class.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

Create a class Recursion. It will have two static methods: removeX and countSubstring and write each function recursively.

Recursion class

removeX

The removeX function will take a String as a parameter. It will return a new String that is the same as the original String, but with all “x” characters removed. This method will be case insensitive.

 

countSubstring

The countSubstring function will take two strings as parameters and will return an integer that is the count of how many times the substring (the second parameter) appears in the first string without overlapping with itself. This method will be case insensitive.

 

For example:

countSubstring(“catwoman loves cats”, “cat”) would return 2

countSubstring(“aaa nice”, “aa”) would return 1 because “aa” only appears once without overlapping itself.

Create a Main class to test and run your Recursion class.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Declaring and Defining the Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT