Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
java import javaioBufferedReader import javaioBufferedWriter import javaioFileReader import javaioFileWriter import javaioIOException import javaioInp...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started