Question: I need help with a java prject that attempts characters that make up a string you have input. I cant figure it out. This is

I need help with a java prject that attempts characters that make up a string you have input. I cant figure it out.

This is what i have so far

import java.util.ArrayList;

import java.util.Scanner;

public class GuessCharacter

{

private static String spaces = " ";

private static Scanner scan = new Scanner(System.in);

private static String mainString;

private static String answerString;

private static String tempAnswer;

private ArrayList alreadyGuessed;

public static void characters() throws InterruptedException

{

intruduction();

String input = "Yes";

while(input.equalsIgnoreCase("Yes"))

{

readString();

guessDemonstration();

input = makeChoice();

}

}

private static void readString() throws InterruptedException

{

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

mainString = scan.nextLine();

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

}

private static void guessDemonstration() throws InterruptedException

{

}

private static void intruduction() throws InterruptedException

{

System.out.println("" +

spaces+"This game prompts for a string of words. It "+

spaces+"then allows the player to guess the characters "+

spaces+"in the string of words. It keeps track of the "+

spaces+"characters guessed and tells the player when he "+

spaces+"wins. ");

}

private static String makeChoice() throws InterruptedException{

String input;

System.out.println(" ");

System.out.println(spaces + "Would you like to play this game again?");

System.out.println(spaces + " please enter yes or no ");

input = scan.nextLine();

System.out.println(" ");

return input;

}

}

desired output

This game prompts for a string of words. It then allows the player to guess the characters in the string of words. It keeps track of the characters guessed and tells the player when he wins. This is my code so far Please enter a string of words. this is a sting Original string: this is a sting Guessed string: ??????????????? Characters to choose from: abcdefghijklmnopqrstuvwxyz Please guess a character. Character read: Original string: this is a sting Guessed string: ???? ?? ? ????? Characters to choose from: abcdefghijklmnopqrstuvwxyz Please guess a character. e Character read: e Original string: this is a sting Guessed string: ???? ?? ? ????? Characters to choose from: abcd fghijklmnopqrstuvwxyz Please guess a character. f Character read: f Original string: this is a sting Guessed string: ???? ?? ? ????? Characters to choose from: abcd ghijklmnopqrstuvwxyz Please guess a character. 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!