id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > feb27_2018_APSLHL_hangman
prev  |  next  |  chance

Write a method that helps in making a hangman game. Parameters are as follows: 'hiddenPhrase' will be the correct solution to the hangman game. 'currentShownLtrs' will be the current state of the game, with some letters potentially revealed, but other letters hidden as "*". 'ltr' will be the letter that was just guessed. If 'ltr' is one of the letters that has not yet been revealed, then that letter will not be revealed everywhere it appears in the 'hiddenPhrase'. Look at the test data for examples. The only string methods you may use are .length, .substring, .charAt, and .equals.


feb27_2018_APSLHL_hangman("SWIM", "S***", "I") → "S*I*"
feb27_2018_APSLHL_hangman("RACECAR", "*******", "A") → "*A***A*"
feb27_2018_APSLHL_hangman("WEATHER", "WEA**ER", "J") → "WEA**ER"

...Save, Compile, Run (ctrl-enter)

public String feb27_2018_APSLHL_hangman(String hiddenPhrase, String currentShownLtrs, char ltr) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 280

Copyright Nick Parlante 2017 - privacy