import java.util.*;
import java.io.*;
public class hangman
{
public static void main(String [] args) throws IOException
{
int maxTries = 7;
int secretWordLen;
Scanner fileScan = new Scanner(new FileInputStream("words.txt"));
String wordlist = fileScan.next();
String secretWord [] = wordlist[(int)Math.floor(Math.random() * wordlist.length)];
secretWordLen = Math.min(s.length(), maxWordLen);
for (i=0; i<secretWordLen; i++)
{
secretWord[i] = s.charAt(i);
}
System.out.println("Welcome to the game of HANGMAN!!!!");
System.out.println("You will have 7 chances to guess what the word is.");
Scanner inScan = new Scanner(System.in);
System.out.print("Please Enter Your name: ");
String name = inScan.next();
hangPlayer = new player(name);
System.out.println(hangPlayer);
}
}
private class player
{
private player(String name)
{
int winCount = 0;
int loseCount = 0;
System.out.print(name + (", you have won " + winCount + " and you have lost ") + loseCount);
return name;
}
}
Any suggestions or hints are helpful.
THANKS

New Topic/Question
Reply



MultiQuote


|