This assignment is due in the OIS drop box by noon, Sunday October 16. You should submit
Week04.java (the class name must be Week04)
You will write a program to copy and line number a “.txt” (or other ASCII) file.
Use Chooser (see 13.7 on p 820 of the book, 808 of the old edition) to identify a file for input.
Use Chooser to identify a file for output.
Read the file line-by-line using FileReader and BufferedReader. As you read the file (in the “Read loop”, write out each line, preceded by “N: “. For example, if the file looks like:
Mary had a little lamb.
It followed here every where she went.
Including the Kitchen (poor lamb).
The output should look like:
1: Mary had a little lamb.
2: It followed here every where she went.
3: Including the Kitchen (poor lamb).
When the program has copied the file, it should display (on the console or using JOptionPane) text like:
Done, copied C:\users\dave\documents\mary.txt to
C:\users\dave\documents\javatest\maryout.csv
There were 3 lines and 88 characters
Here is a random number between 1 and 500: 421
(That 88 is an estimate, I didn’t count) The last line should display an integer in the range of 1 and 500, using the Random class.