Programming
Creating hangman game.

Question Description

I need an explanation for this Programming question to help me study.

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

}

}


Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

Final Answer

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

Faris123 (10)
Purdue University

Anonymous
Top quality work from this tutor! I’ll be back!

Anonymous
Just what I needed… fantastic!

Anonymous
Use Studypool every time I am stuck with an assignment I need guidance.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

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