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

 

andersoniii.edwin@cusd80.com > hangMan2
prev  |  next  |  chance

Write the method called “hangMan2”. This method receives a string and a letter (character) representing a guessed letter and returns a String where each letter given is displayed and all other characters have been replaced with a hyphen. Given: I Love Java, "a" this would return - --- -a-a DO NOT USE THE UNDERSCORE. We will assume the words are separated by just one space.No beginning space, BUT there will always be an ending space character. Ignore case - change every phrase to lower case.


hangMan2("I Love Java", "a") → "- ---- -a-a"
hangMan2("Math Is For Champions", "a") → "-a-- -- --- --a------"
hangMan2("What a good day", "o") → "---- - -oo- ---"

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

public String hangMan2( String phrase, char guess){ }

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: 100

Copyright Nick Parlante 2017 - privacy