Question
Java question: Use this Poem: Mary had a little lamb whose fleece was white as snow. everywhere that Mary went The lamb was sure to
Java question:
Use this Poem:
Mary had a little lamb
whose fleece was white as snow.
everywhere that Mary went
The lamb was sure to go!
1. Create a text file with the poem.(By using Mary had a little lamb.) Put one line of the poem or song on one line of the text file. Use this file as your input file.
2. Write code to read each line from your input file.
3. Write each line to an output file with the line number preceding 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.
4. Print a line to the console reporting that your file rewriting was completed:
* "Read in %s. Wrote out %s.", inputName, outputName
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