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:

Published on December 2017 | Categories: Romance | Downloads: 88 | Comments: 0 | Views: 496
of 1
Download PDF   Embed   Report

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.

Comments

Content

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.

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close