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);
}
}
Explanation & Answer
Review
Review
24/7 Homework Help
Stuck on a homework question? Our verified tutors can answer all questions, from basic math to advanced rocket science!
Similar Content
Related Tags
Animal Farm
by George Orwell
The Handmaids Tale
by Margaret Atwood
Unf*ck Yourself
by Gary John Bishop
Night
by Elie Wiesel
The Age Of Light
by Whitney Scharer
The 7 Habits of Highly Effective People
by Stephen R. Covey
Sense And Sensibility
by Jane Austen
Siddhartha
by Hermann Hesse
Persuasion
by Jane Austen