package Hangman; import java.util.*; public class DictionaryManager { final stat
ID: 3547586 • Letter: P
Question
package Hangman;
import java.util.*;
public class DictionaryManager {
final static String[] dictionaryArray = {"scissor",
"size",
"98 more words and phrases"};
public static void main(String[] args) {
}
public static String[] initDictionary () {
// Returns a randomly sorted list of words that
// will be used as the dictionary for the current game.
String[] gameDictionary = Arrays.copyOf(dictionaryArray, dictionaryArray.length);
return gameDictionary;
}
public static String pickSecretWord (String[] dictionary) {
// Picks the next secret word or phrase from the dictionary. To do this,
// search through the dictionary array until an empty string is found.
// The next secret word will be the last array element before the empty string.
// If all the words have been used in the game (array element 0 is the empty string),
// initialize the dictionary again.
// Put an empty string in the element that was used for the secret word, otherwise words
// will be reused in the same game.
// Returns the secret word.
String secretWord = "";
return secretWord;
}
public static boolean isLetterInSecretWord (String secretWord, char letter) {
// if letter is contained in secretWord, return true otherwise return false.
boolean result = false;
return result;
}
public static int nextPosition (String secretWord, char letter, int previousPosition) {
// Finds a letter in secretWord, starting the search from the previousPosition.
// Returns the position of the letter or a -1 if the letter was not found.
// This method is useful if the same letter appears more than once in secretWord.
int nextPos = -1;
return nextPos;
}
}