private static int readFile (String filename, String[] capacities)
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
private static void displayResults(String[] rooms, int size)
{
int size=rooms.length;
JTextArea textArea = new JTextArea();
textArea.setEditable(false);
// Print Array output text area:
for ( int i = 0; i < size; i++ )
textArea.append(rooms[i]+"\n");
// Display the Array via a message dialog box:
JOptionPane.showMessageDialog(null, textArea);
}