Question
Create a text file with Mary had a little lamb. Put one line of the poem on one line of the text file. Use this
Create a text file with Mary had a little lamb. Put one line of the poem on one line of the text file. Use this file as your input file. Write code to read each line from your input file. Write each line to an output file with the line number preceeding the line. Be sure to follow this example for the format of the line number. Input file: Mary had a little lamb. Output file: /* 1 */ Mary had a little lamb. Putting the line number in comments will make your code more flexible. Now it can be used to number lines of code in a source code file. Print a line to the console reporting that your file rewriting was completed: "Read in %s. Wrote out %s.", inputName, outputName. java code..
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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