Creating hangman game.

User Generated

Gernfher1100

Programming

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);

}

}


User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

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


Anonymous
Really helpful material, saved me a great deal of time.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags