Creating hangman game.

Anonymous
timer Asked: Aug 1st, 2013
account_balance_wallet $5

Question Description

This is how the output should look like. http://prntscr.com/1is9ht
Don't use arrays cuz we haven't learned that

This is my code so far

int count=1;

while (count<=24){

Scanner keyboard = new Scanner(System.in);

int length;

String originalString;

String guess;

String option= "abcdefghijklmnopqrstuvwxyz";

String questionmarks;

System.out.println("Please enter a string");

originalString=keyboard.nextLine();

length=originalString.length();

questionmarks = originalString.replaceAll(".", "?");

System.out.println("Original String: "+originalString);

System.out.println("Guessed String: "+questionmarks);

System.out.println("Characters to choose from: "+option);

System.out.println("Please guess a character");

guess=keyboard.nextLine();

if (originalString.contains(guess)){

count++;

}

else{

option.replace(guess, "_");

count++;

System.out.println(option);

}

}


Tutor Answer

Faris123
School: Purdue University

Hangman game.txt 
This file contains the required code 
Hope it helps :)

flag Report DMCA
Review

Anonymous
Goes above and beyond expectations !

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors