Poem Generator - HELP


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Poem Generator - HELP

  1. #1
    Join Date
    Dec 2003
    Posts
    3

    Poem Generator - HELP

    Im in the process of trying to code a poem generator in Java and im stuck.

    Basically my program has to read from a text file (one word per line) into an array and then choose 2 random array indexes and the corresponding words.

    Using substring strip each word down to the last 3 characters and then use .equals to see if they match.

    The rest of the program after that is easy but im so stuck right now

    So far all ive done is open the file and read the length of it, i really could do with some help as to how to read the contents of the file into an array etc.

    Thanks in advance

  2. #2
    Join Date
    Mar 2003
    Posts
    834
    So far all ive done is open the file and read the length of it, i really could do with some help as to how to read the contents of the file into an array etc.
    What exactly is the problem? Just declare an array of Strings (I'd use a java.util.List personally) and read each line into the next index.
    ArchAngel.
    O:-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center