Create a class called FlashCardReader. Import BufferedReader and FileReader. Declare a BufferedReader instance variable called reader
.
The FlashCardReader constructor should have a string parameter to provide a filename and it should create a BufferedReader which reads from a file with the given filename. Compile. You would (should!) be alerted to a problem that the compiler has found.
Surround the line(s) with an appropriate try-catch block of code. You'll find the correct exception name on the compiler message. You'll need to import the Exception. In the catch block print out a helpful error message.
Write a method called getLine in the class. Have it return the next line of the contents of the file. Have a look at the API and the methods in BufferedReader to do this. (This is to test that your file reading is working. You may later change this, to make it work with your code in Parts 2 & 3).
Write a boolean method fileIsReady
to find out whether the file is ready to be read. Use a method from the BufferedReader class. It should return false if there is some other reason why the FlashCardReader is unable to provide data, for example if there was a problem creating the BufferedReader or FileReader.