View Single Post
  #1 (permalink)  
Old 04-28-2008, 05:32 AM
Shadow22202 Shadow22202 is offline
Member
 
Join Date: Apr 2008
Posts: 5
Shadow22202 is on a distinguished road
"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
Reply With Quote
Sponsored Links