Question: 1 ) Create a Java Project that writes console input ( Scanner ) to a txt file and then reads the same txt file and
Create a Java Project that writes console input Scanner to a txt file
and then reads the same txt file and displays it back to the console.
a The main method will call the write method, then the read
method which will print the file contents to the console.
b The write method will prompt the user for input using the
Scanner and read the input in and write it to a file.
Use a PrintWriter with a nested BufferWriterFileWriter It is only
necessary to write one line of text from Scanner.
Append new input to what is already in the file each time project
is run.
c Create OutputFile.txt file in project by right clicking project
and saying New, Untitled Text File, Save As OutputFile.txt
This way we can use OutputFiletxt and dont need to include
a path and can run from any computer.
d The read method will use a BufferedReaderFileReader it
should read multiple lines in the Output.txt file if they exist.
Extra Credit points : Include a loop to enable multiple lines of
input from the Scanner into the output text file.
Hint display output on screen telling user to enter X to exit and
when they do exit the loop
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
