Question
/** * This method finds all occurrences of guess in secretWord and returns new * disguisedWord with letters revealed after guess * * @param guess
/**
* 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"));
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started