Question: Write a Java program that will input a file name to be opened for reading. The java file must only read the first sentence
Write a Java program that will input a file name to be opened for reading. The java file must only read the first sentence of the file and print on the output. Each line of code should be explained with comments. The requirements of your Java program is listed below (Total: 30 marks) a) Ensure all the necessary packages and classes needed for the program development are made available, with a class to define the data members and functions that the object of this scenario should have. [2 marks for the comment] (5 marks) b) This class should also host the following methods o A function to write a new filename from the keyboard. Note the file name should be inputted from the user. [2 marks for the comment] (5 marks) o A function to write to a stored text file on your system, write text to be inputted by the user. [3 marks for the comment] (6 marks) c) Exception handling mechanisms should be included in your program wherever they are needed to ensure the smooth running of your program. o The exception handler should be suitable for the possible exceptions that may occur. o 4 marks for the comment. (8 marks) d) A class hosting the main method and creation of object to test the functionalities. o Ensure that all variables are used and functions are tested.
Step by Step Solution
3.43 Rating (159 Votes )
There are 3 Steps involved in it
java import javaioBufferedReader import javaioBufferedWriter import javaioFileReader import javaioFileWriter import javaioIOException import javaioInp... View full answer
Get step-by-step solutions from verified subject matter experts
