Posted: Fri Oct 05, 2012 4:30 pm Post subject: Manipulating text from the file
The code prints different reports my question is how to print the text from the file in columns of 5 words each per line. The method that supposed to do that, is public void printTokens() but not sure if the loop is properly set up.
fileScan = new Scanner (new File(str1));
validName = true;
int lineCount =0;
System.out.println("\tReport1 - Text in Data File");
System.out.println();
System.out.println("-------------------------------------------------------");
while (fileScan.hasNextLine( ))
catch(FileNotFoundException fnfe)
{
System.out.println("Invalid File name; enter again");
}
}while(!validName);
}//end storeTokens
public void printTokens()
{
System.out.println();
System.out.println("\tReport2 - Words without punctuation");
System.out.println();
System.out.println("-------------------------------------------------------");