Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

plz delete

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
plz delete
[ December 04, 2004: Message edited by: C Ho ]
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First thing you'll need to do is to read in your text file and capture the data in a String .. I assume that each Shape will at least be on a different line in the text file.
Then you'll need to parse the String using the split command this will give you a sinle dimension array for each String. If you can get that far you'll be 90% of the way there.
Have a go at reading in the file first and if you are having problems post back.
Good luck,
Barry
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What have you tried so far? You probably need to use FileInputStream, FileReader, or some other classes from the java.io package. That's where I suggest you start.

Keep Coding!

Layne
 
C Ho
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"First thing you'll need to do is to read in your text file and capture the data in a String .. I assume that each Shape will at least be on a different line in the text file.
Then you'll need to parse the String using the split command this will give you a sinle dimension array for each String."

Are there any examples? I find that I learn best with example, else I just sit on a chair coding for hours, days, weeks without progress because I simply do not know what Im doing!
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have a textbook? It should have plenty of examples. You may also want to see if the Java Tutorial has something appropriate to help you. Also, the links to the Java API documentation I gave above have a lot of helpful information, even if there are not full code examples.

Layne
 
C Ho
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No textbook, school is really crappy..
 
C Ho
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this is what i have so far:



I keep getting this error though, can someone please help me?

Error: cannot resolve symbol
symbol : class IOException
location: class ReadFileToArray
 
C Ho
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello?
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It may be as simple as adding an import at the top of the class ... right after package if you have one, right before class.

import java.io.IOException;
 
C Ho
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks
, now i can finally see how this makes sense
[ December 04, 2004: Message edited by: C Ho ]
 
Hey! You're stepping on my hand! Help me tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic