Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

/** * This method finds all occurrences of guess in secretWord and returns new *

ID: 3741256 • Letter: #

Question

/**

   * This method finds all occurrences of guess in secretWord and returns new

   * disguisedWord with letters revealed after guess

   *

   * @param guess

   * @param secretWord

   * @param disguisedWord

   * @return

   */

public static String makeGuess(String guess, String secretWord, String disguisedWord) {

// throw new UnsupportedOperationException("Remove this line and replace with your implementation.");

          

}

//Below is the testcases

@Test

public void testMakeGuess() {

assertEquals("optio_", Hangman.makeGuess("g", "option", "optio_"));

assertEquals("option", Hangman.makeGuess("n", "option", "optio_"));

assertEquals("opt___", Hangman.makeGuess("opt", "option", "______"));

assertEquals("_p_ion", Hangman.makeGuess("ion", "option", "_p____"));

assertEquals("option", Hangman.makeGuess("pt", "option", "op_ion"));

}

Explanation / Answer

/** * This method finds all occurrences of guess in secretWord and returns new * disguisedWord with letters revealed after guess * * @param guess * @param secretWord * @param disguisedWord * @return */ public static String makeGuess(String guess, String secretWord, String disguisedWord) { // throw new UnsupportedOperationException("Remove this line and replace with your implementation."); String str=""; for(int i = 0; i