Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help: Read file, get #, set arry size, display #s,etc.

 
Cain Silverbane
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, here is the deal. I am getting ready for a test and trying to practice stuff, so the prof. gave me a lab. It is supposed to basically use a filename as a command line argument, read the #s in, and print them out in a neat 5 column style.
The #s are supposed to be sorted first, lowest to highest [without using arrays.sort()]. Also, the first # in the file needs to be set to the array length. He said to use Integer.toString() for spacing, and to make a reusable file-sorting object.
He also is letting us use a LineFilter class that we have made before in class (see below). If anyone can throw some code to give me an idea how to do it / start, I would appreciate it.
 
Cain Silverbane
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm... still not getting anywhere. We are supposed to make LineFilter private and then create a main to do various things, as well as other methods... basically get the numbers from a file, sort em, print em... Ack.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which part(s) of the assignment are you having difficulty with? What have you tried so far?
 
Cain Silverbane
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the main things Im having trouble with is getting the first number to be the size of the array, and the others to go into the array. A sorting method should be simple enough, and getting the display isn't worrying me too much.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic