Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

File Processing Complete the class code below and write a static method named reverseLines that accepts a Scanner containing an input file as a parameter

File Processing

Complete the class code below and write a static method named reverseLines that accepts a Scanner containing an input file as a parameter and that echoes the input file to System.out with each line of text reversed. For example, given the following input file:

If this method works properly,

the lines of text in this file

will be reversed.

Remember that some lines might be blank.

Your method should print the following output:

,ylreporp skrow dohtem siht fI

elif siht ni txet fo senil eht

.desrever eb lliw

.knalb eb thgim senil emos taht rebmemeR

Note: some of the input lines can be blank lines.

public class ReverseLines {

public static void main(String[] args)

{

Scanner fileIn = new Scanner(new File("story.txt"));

reverseLines(fileIn);

}

} // end of ReverseLines class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

1489982175, 978-1489982179

More Books

Students also viewed these Databases questions

Question

3. Explain the forces that influence how people handle conflict

Answered: 1 week ago