When an error occurs, your catch will ignore any and all values on the line (you can use nextline() to skip any remaining data on the line.

Hello,
This programming assignment will deal with I/O and exception handling. You will call this program
FileIOProg.java. You will lost points if your program name is incorrect. I will provide a text file call Input.txt which will have lines with four fields each. The fields will be separated by a tab character. The fields will contain in this order: a floating point value, a second floating point value, an integer, and a second integer.
Open the file and read the data using a Scanner object. Be prepared to handle lines which do not conform to the above format. When your program encounters a field that does not have the proper format, handle the resulting exception using a try catch block. When an error occurs, your catch will ignore any and all values on the line (you can use nextLine() to skip any remaining data on the line.
You may skip processing the remainder of the line.

Leave a Reply

Your email address will not be published. Required fields are marked *