import java.util.*;
import java.io.*;
public class lab10 {
/**
* @param args
*/
public static void main(String[] args) throws FileNotFoundException{
// TODO Auto-generated method stub
printIntro();
String [] words = new String [40];//size of the array
Scanner console = new Scanner(System.in);
System.out.println("Enter a letter");
String guessLetter = console.next();//this store the letter the user most type
readWords(words);//this method store all words in an array
String secretWord = getWord(words);//this method choose a random word from 40 elements in the array and stores it.
}
public static void printIntro(){
System.out.println("Welcome to hangman try to guess the secret word," +
" you have 6 chances.");
}
public static void readWords (String[] words){
File file = new File ("words.txt");
try {
Scanner console = new Scanner (file);
int index = 0;
while(console.hasNextLine()){
String word = console.nextLine();
words[index] = word;
index++;
}
}
catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public static String getWord (String[] words){
Random rand = new Random ();
int index = rand.nextInt(40);
String secretWord = words[index];
return secretWord;
}
public static int processGuess (char guess, String secretWord, char[] status){
}
}