The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 2 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Write a class called FileOperations that accepts a string value in a variable called str which represents the name of a text file residing on an external storage device. Provide the following:
a)     A constructor that accepts the string str, representing the file name, and creates a LineNumberReader object.                                                                                   [ 1 mark]
(b)    A mutator method that reads the file line by line until the file is empty.                 [ 2 marks]
(c)     An accessor method that determines if the actual file exists.                                 [ 1 mark]
(d)    An accessor method that returns the number of bytes in the file.                         [ 1mark]
(e)     An accessor method that returns the name of the file.                                         [ 1 mark]
(f)      The declaration of appropriate variables and use of Exception where necessary.   [ 2 marks]
Â
Note :– a test class is NOT required
Â
Â
Â
Â
Exceptions identify errors that arise in your program. Name the two categories of exceptions that are derived directly from Throwable and differentiate between them.