So far I got the program to tell me if the user's inputted letter is right or wrong, but how can I have the computer tell the user what slot the guessed letter (if correct) is in? I.e. the letter "e" is in the first and last slots.
This is what I have so far, but all it says is the previously used wrong letters and previously guessed right letters, but not in the order of the word.
JOptionPane.showMessageDialog (null, "You have guessed all of the following letters incorrectly: \n" + guessedWrongLetters + "\n \nYou have guessed all of the following correct letters: \n" + guessedRightLetters);
Also, How can I generate a random integer between one and 250 that is a multiple of five? I.e. 5, 10, 15, etc. I'm using the
String.substring (+start+,
end) method to choose a random word from a single variable "wordlist" that contains 50 five letter words.
This is what I have, but it just chooses at random letter for the first part of the substring, and adds five to that chosen letter for the second part. So it sometimes chooses something in the middle of a word.
compNumOne = 1 + randy.nextInt (245);
compNumTwo = compNumOne + 5;
itsComputersWord = itsComputersWordList.substring(compNumOne, compNumTwo);
Here is the word list:
private String itsComputersWordList = "firstbibleshoeshoneyearthgloveapplechildshipsboatsaortaacidsallowroadsburntbusesdocksbucksbuddydudesudderembedemberelveseggedentryebonydunesdoweldozeldoorsdiverdisksdirksdinerdualsfrothelbowfryerfrozefrownfretsfumedgullsneckshairyhabitlinenlilacmedal";}
Edited by: Pluberus on Nov 20, 2008 4:17 PM - Fixed a mistake.