I know you probably see a hundred of these during this time of year, but I have a project going at uni that requires us to create a string based hangman game from scratch. It's not anything fancy, and the game itself isn't too complicated, but where I'm having trouble is one, comparing a users input using a JOptionPane.showInputDialog. So the user enters a letter and this letter is compared with the String. If the user enters a letter that is in the String, the program replaces every "_" with the letter entered. I haven't really done all that much work with Strings or with any kind of loops, so I'm a little bit clueless.
Another problem I'm facing is that we are required to code 3 methods that the user has the option of running. These are:
removeDoubletons() //This method should remove any appearance of the same letter e.g. "Cool" would become "Cl"
randomMove() //This method returns a string where all characters in the source string are shifted to the right by a random amount between 2 and the length of the string.
removeVowels() //This goes through the string sequentially and every time a vowel is found, it is removed. I think I'll be ok with this method.
Here is a summary of my task
Player is asked to enter a string of text in a JOptionPane.showInputDialog
Once a string of appropriate length has been entered a dialog box should appear asking the user whether they want to run method1 (removeDoubletons)
If the user clicks Yes then the removeDoubletons method is performed on the input string of text.
Regardless of which button the user pressed another dialog box should then appear asking the user whether method 2, randomMove should be performed on the input string.
If the user clicks Yes then the randomMove method is performed on the input string of text.
Regardless of which button the user pressed another dialog box should then appear asking the user whether method 3, removeVowels should be performed on the input string.
Once the user has decided whether or not to run any of your string manipulation methods the game should run.
Basically, the rest of the task is to replace "-"s with correctly guessed characters and check any word guesses against the original string.
Now I know it probably looks like I'm asking you to do my homework, but I promise I'm not. I don't expect anyone to give me any solid code and a quick solution. What I would like is some sort of pointers, hints, classes to use that I can go ahead and research.
Really appreciate any help that you guys can provide me with!