Find and Replace
Consider the string:
I am a bad, bad boy!
Suppose I want to develop a find and replace program common to most word processors. In this case, I want to find the word bad and replace it with good.
You are to implement this function using the following functions:
public static String findFirst(String original, String search, String replaced)
//returns the altered string with only the first occurrence replaced or the original string if the searched phrase is not present)
public static String findAll(String original, String search, String replaced)
//returns the altered string with all occurrences replaced or the original string if the searched phrase is not present)
Obviously, the first method does all the work, and most likely will be called by the second one. Also, despite the existence of methods in the String class that perform this work….please refrain from using them in solving this lab.