Results 1 to 9 of 9
  1. #1
    Shadow22202 is offline Member
    Join Date
    Apr 2008
    Posts
    5
    Rep Power
    0

    Default "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

  2. #2
    Zosden's Avatar
    Zosden is offline Senior Member
    Join Date
    Apr 2008
    Posts
    384
    Rep Power
    10

    Default

    Try this Forum. this same topic has already been started
    My IP address is 127.0.0.1

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,370
    Blog Entries
    1
    Rep Power
    23

    Default

    Shadow22202 use the same thread you have already started. Please don't start separate threads.

  4. #4
    Zosden's Avatar
    Zosden is offline Senior Member
    Join Date
    Apr 2008
    Posts
    384
    Rep Power
    10

    Default

    Ha didn't even look to see if it was the same person lol
    My IP address is 127.0.0.1

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,370
    Blog Entries
    1
    Rep Power
    23

  6. #6
    Shadow22202 is offline Member
    Join Date
    Apr 2008
    Posts
    5
    Rep Power
    0

    Default

    Sorry wont happen again

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,370
    Blog Entries
    1
    Rep Power
    23

    Default

    Quote Originally Posted by Shadow22202 View Post
    Sorry wont happen again
    Yes pal, It's much better. :)

    Did you solve the problem?

  8. #8
    Shadow22202 is offline Member
    Join Date
    Apr 2008
    Posts
    5
    Rep Power
    0

    Default

    Ya i solved it, thank you

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,370
    Blog Entries
    1
    Rep Power
    23

Similar Threads

  1. Hwlp with "Open", "Save", "Save as..."
    By trill in forum New To Java
    Replies: 3
    Last Post: 11-02-2010, 10:26 AM
  2. Replies: 1
    Last Post: 03-14-2008, 03:51 PM
  3. Replies: 1
    Last Post: 07-27-2007, 11:59 PM
  4. Replies: 1
    Last Post: 07-25-2007, 11:55 PM
  5. Replies: 1
    Last Post: 07-16-2007, 07:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •