read info from txt file

the file whose filename is given as a parameter, and fills array of strings representing
capacities.
Error checking:
Each line of the file should be checked for the following errors. Lines of the file that contain
errors should not be put in the array (print them to the system console).

The line should have exactly three fields

The capacity muse be greater than zero and less than 3000

The test for validity should be done by the method isValidRoom described below. The returned
value of the readFile method is the number of rooms successfully put in the array.

anyone can help with that i dont know really how to start it :S

data that should be in txt is

NSB|C205|164
NSB|B141|50
PH|C213|40
NSB|B145|50

also i got another question about another method

well i have this print method but when ever i try 2 use it it give me an error illegal start of expression
so any idea

Where do you get your error at the following?
And why do you have size as an argument since you are calculating it in the method. It won't matter what value it will have when you call the method since it will take a new value; the size of the array.

well thx for the 1st part...i will give it a shot , and about the 2nd code i think u got the question wrong ..well the code wht it should do it check that the data in the txt file are on this format NHB|c241|200 , also to check if the last part is less than 3000 which i have the idea to use stringtoknizer to get the last part of the string and parse into int and see if it less than 3000 or not ...so if u gt more ideas let me know and also if i foud smthin i ll share it

I am not going to do your homework for you. I gave the code for reading lines from a file. Each line is stored in the String: String s=bReader.readLine();. What you do with the string is your job. Is not that difficult; use StringTokenizer, or split(), and then make the necessary checks.
I don't know what the assignments says, but you could create a class with 3 attributes. Every time you read a line, create a new object with values, the values you get from the line, and store that object in an ArrayList, or Vector.

u can still use the tokenizer class and the nextToken function if u like. Just read the values from nextToken into an array, then display the array from the back, by starting at array size and iterating down to zero