Question: Please solve using WHILE loops but NOT using indexOf public class XyzMiddle { /** Write the method xyzMiddle(). Given a String str, does xyz appear
Please solve using WHILE loops but NOT using indexOf

public class XyzMiddle { /** Write the method xyzMiddle(). Given a String str, does "xyz" appear in the "middle" of the string. To define middle, we'll say that the number characters to the left and right of the "xyz" must differ by, at most, one. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 Examples: XyzMiddle("AAXyzBB") returns true XyzMiddle("AXYZBB") returns true XyzMiddle("AxyzBBB") returns false @param str the String to examine. @return true if xyz is in the "middle" of str. */ // TODO - Write the method xyZMiddle here. public class XyzMiddle { /** Write the method xyzMiddle(). Given a String str, does "xyz" appear in the "middle" of the string. To define middle, we'll say that the number characters to the left and right of the "xyz" must differ by, at most, one. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 Examples: XyzMiddle("AAXyzBB") returns true XyzMiddle("AXYZBB") returns true XyzMiddle("AxyzBBB") returns false @param str the String to examine. @return true if xyz is in the "middle" of str. */ // TODO - Write the method xyZMiddle here
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
