Implement the writeWithLineNumbers
method that reads a file and writes to a PrintWriter
, prepending a three-digit line number for each line, like this:
001: line 1 002: line 2 . . .
If there are more than 999 lines, the method should throw a TooManyLinesException
, which you should define as a subclass of IOException
. When the file doesn't exist, the method should throw a NoSuchFileException
.