* Project12.java * * A program that plays simple word guessing game. In this gam
ID: 3547537 • Letter: #
Question
* Project12.java
*
* A program that plays simple word guessing game. In this game the user provides a list of
* words to the program. The program randomly selects one of the words to be guessed from
* this list. The player then guesses letters in an attempt to figure out what the hidden
* word might be. The number of guesses that the user takes are tracked and reported at the
* end of the game.
*
* See the write-up for Project 12 for more details.
*
* @author ENTER YOUR NAME HERE
*
*/
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Project12 {
public static void main(String[] args) {
// Fill in the body
}
// Given a Scanner as input, returns a List<String> of strings read from the Scanner.
// The method should read words from the Scanner until there are no more words in the file
// (i.e. inScanner.hasNext() is false). The list of strings should be returned to the calling program.
private static ArrayList<String> getList(Scanner inScanner) {
// Fill in the body
ArrayList<String> list = new ArrayList<String>();
return list;
}
// Given two strings as input, compares the first string (guess) to the second
// (solution) character by character. If the two strings are not exactly the same,
// return false. Otherwise return true.
private static boolean checkWord(String guess, String solution) {
// Fill in the body
}
// Given a ArrayList<String> list of strings as input, randomly selects one of the strings
// in the list and returns it to the calling program.
private static String getRandomWord(ArrayList<String> inList) {
// Fill in the body
}
// Given a Scanner as input, prompt the user to enter a character. If the character
// enters anything other than a single character provide an error message and ask
// the user to input a single character. Otherwise return the single character to
// the calling program.
private static char getCharacterGuess(Scanner inScanner) {
// Fill in the body
}
// Given a character inChar and a ArrayList<Character> list of characters, check to see if the
// character inChar is in the list. If it is, return true. Otherwise, return false.
private static boolean checkInList(char inChar, ArrayList<Character> inList) {
// Fill in the body
}
// Given a String, return a String that is the exact same length but consists of
// nothing but '*' characters. For example, given the String DOG as input, return
// the string ***
private static String starWord(String inWord) {
// Fill in the body
}
// Given a character and a String, return the count of the number of times the
// character occurs in that String.
private static int checkChar(char guessChar, String guessWord) {
// Fill in the body
}
// Given a character, a String containing a word, and a String containing a 'guess'
// for that word, return a new String that is a modified version of the 'guess'
// string where characters equal to the character inChar are uncovered.
// For example, given the following call:
// modfiyGuess('G',"GEOLOGY", "**O*O*Y")
// This functions should return the String "G*O*OGY".
private static String modifyGuess(char inChar, String word, String currentGuess) {
// Fill in the body
}
}
Explanation / Answer
Hi I pasted your code here http://pastebin.com/Sjv2Ee1N
Make sure when you run it you have a "words.txt" file under the project folder.
If you have any questions comment here I will help you out.
Please rate me 5 stars if ths was helpful
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.