Menu

[Solved]Bet T Figure Create Recursive Method Test Whether Partial String Subset Full String Partia Q37107932

Bet you can’t figurethis out

Create a RecursiveMethod to test whether a partial string is a subset of a fullstring. If the partial string is a subset of the full string returntrue. Otherwise return false.Create a Recursive Method to testwhether a partial string is a subset of a full string. If thepartial string is a subset of the full string return true.Otherwise return false.

Here is the Main andRecursive below: (Note only need theRecursive)

Main:

public classChapter13Main {

  public static void main(String[] args) {
       RecursiveContains rc = newRecursiveContains();

      System.out.println(rc.contains_recursive(“xd”, “thurtle”));// False

      System.out.println(rc.contains_recursive(“th”,”thurtle”)); // True

      System.out.println(rc.contains_recursive(“trl”,”thurtle”)); // True

      System.out.println(rc.contains_recursive(“utl”,”thurtle”)); // True

      // Strings are case sensitive
      System.out.println(rc.contains_recursive(“Tr”, “thurtle”)); //False

   }

}

Recursive:

public classRecursiveContains {

  /**
   * This method tests whether the first String the”partial” is a substring of
   * the “full” string. If the partial string containsall of the characters of
   * the full string in the same order return true. Elsereturn false. Example:
   * “tbl” “table” => true tbl appears in that orderin both strings
   *
   * “tlb” “table” => false tlb does not appear inthat order in the full string.
   *
   */
   public boolean contains_recursive(String partial,String full) {
       return false;
   }

}

Expert Answer


Answer to Bet you can’t figure this out Create a Recursive Method to test whether a partial string is a subset of a full string. I… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *