Due: Tuesday, September 16th by 11:59 PM
Start by downloading CS201_Lab5.zip and importing it into Eclipse. You should see a project called CS201_Lab5.
You will make changes to the class called ReadFile.
Complete the progam so that it prompts the user for the name of a file, and then prints the contents of the file to System.out.
There are several important requirements:
Assume that the file myFile.txt contains the following contents:
Oh freddled gruntbuggly Thy micturations are to me As plurdled gabbleblotchits on a lurgid bee. Groop I implore thee, my foonting turlingdromes And hooptiously drangle me with crinkly bindlewurdles, Or I will rend thee in the gobberwarts with my blurglecruncheon, See if I don't!
Here is an example session showing a file being printed successfully (user input in bold):
Which file? myFile.txtOh freddled gruntbugglyThy micturations are to meAs plurdled gabbleblotchits on a lurgid bee.Groop I implore thee, my foonting turlingdromesAnd hooptiously drangle me with crinkly bindlewurdles,Or I will rend thee in the gobberwarts with my blurglecruncheon,See if I don't!
Here is another example session showing what happens when the user enters the name of a nonexistent file:
Which file? nonexistent.txtError: nonexistent.txt (No such file or directory)
Use a try/catch block to handle an IOException or FileNotFoundException that might occur. Print the error message from the catch block. You can call the getMessage method on the caught exception object to get a string containing a textual description of the error that caused the exception.