Let’s define a new language called dog-ish. A word is in the lan- guage dog-ish if the word contains the letters ’d’, ’o’, ’g’ a
re in the word in order. For example, "dpoags" would be in dog-ish because dpoags. Other words like "dog", "doooooog", "pdpopgp", and "qwqwedqweqweoqweqw- gasd" would be in dog-ish. "cat", "apple", "do", "g", would not be in dog-ish.(a) Define the method inDogish recursively such that it re- turns true if the word is in dog-ish and false if it is not. I left a dogishHelper method, which I guarantee you will need to recursively solve dogish. An iterative solution will receive no points.(b) Define the method inXish that does the same logic of dog- ish but for some word X. The method returns true if the word contains all the letters in the word X. The solution must be recursive. An iterative solution will receive no points.class Main { public static void main(String[] args) {
/* leave this main method blank but feel free to uncomment below lines
to test your code */
// System.out.println(dogish("aplderogad"));
// System.out.println(dogishGeneralized("aplderogad", "dog"));
}
// returns true if the word is in dog-ish
// returns false if word is not in dog-ish
public static boolean inDogish(String word){
return false;
}
// necessary to implement inDogish recursively
public static boolean dogishHelper(String word, char letter) {
return false;
}
// a generalized version of the inDogish method
public static boolean inXish(String word, String x){
return false;
}
}