|
"Jumble" or "Scramble" Program
Can someone please post code on how to scramble words (Like a game that you would play in the newspaper). I just cant seem to figure out how to scramble the words.
This is what my code looks like now:
public class Jumble
{
public static void main(String[] args)
{
String[] wordList = // can be any length
{"MAGIC", "SCORE", "FUNNY", "HELLO", "PROJECT", "VACATION",
"WINNER", "HAPPY", "TARGET", "DELHI", "COMPUTER", "JAVA",
"CLASS", "SMART", "SUMMER", "LATER", "FRIEND", "HIDDEN",
"BOGUS", "FANCY", "HORSE", "TRAIN", "LOVE", "BABY", "WORK",
"PROGRAM", "EASY", "STUDY", "MONEY", "STREET", "LUNCH"};
String theWord;
theWord = wordList[(int) (Math.random() * wordList.length) + 1];
System.out.println(theWord);
}
}
Thank you for any help
|