Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Hangman Java Program


This is a hangman java program that has to follow the specifications outlined. Cannot use anything out of the java APi except Java.util.scanner. Cannot use arrays, etc. Must be really rudimentary. Attachments Tags Clarifications


Java - Hangman Solution


Attached is the solution to the Java - Hangman assignment including source and comments. No arrays are used, only strings and specific substring methods from the string to do the replacements. Attachments (3 K) Download Preview
//validate guess if(guess.length() != 1){ System.out.println("Sorry, bad guess. Need a single letter."); } else { //get character char c = guess.toLowerCase().charAt(0); //make sure not guessed already while(disguisedWord.indexOf(c) >= 0 || incorrectGuessedLetters.indexOf(c) >= 0){ System.out.println("Already guessed that one, try again.");

Purchase Answer