Question: IN JAVA Write two recursive methods called deleteFirst and deleteAll. Both methods have two parameters, a string str, and a character ch. In the deleteFirst

IN JAVA

Write two recursive methods called deleteFirst and deleteAll. Both methods have two parameters, a string str, and a character ch. In the deleteFirst method, delete the first occurrence of ch in the string strand return the new string. In the deleteAll method, deleteall the occurrences of chin the string strand return the new string. In both cases, if chis not in string str, return the original string. Both methods have to be recursive.Also write a main method to test the two recursive methods. Your main method should print a menu as the following: 1.Test deleteFirst method 2.Test deleteAll method 3.ExitThe menu should be repeated until user selects 3 to exit. For each testing, your program should ask user to enter the input string and a character, each on a separate line, and then print the output string after calling the corresponding method.Place all three methods in the same class. Name your class as RecursionTest.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!