Question: Write the program sam.java to process the text of this file. Use a Scanner to read lines from sam.txt, and write code to modify the

Write the program sam.java to process the text of this file. Use a Scanner to read lines from sam.txt, and write code to modify the file. Translate all of the odd-numbered lines to all lower case, and all of the even-numbered lines to all upper case, skipping any empty lines. That is, if the line before a blank line is the lower case then the next line after the blank should be upper case, regardless of the offset line number. Leave the blank lines in your output file so that the formatting of the text remains the same.

Write your output to a new file called samnew.txt. Use a PrintWriter object to write your translated output to the file.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!