Question: *JAVA DATA STRUCTURES* Assignment: Write a program that takes two command line arguments giving the names of the input and output files respectively. Your program

*JAVA DATA STRUCTURES*

Assignment: Write a program that takes two command line arguments giving the names of the input and output files respectively. Your program will read each line of input, parse the tokens, then print each token backwards to the output file on a line by itself. For example, given a file called "in" containing the lines:

abc defg

hi

jkl mnop q

the command (on unix) %FileReverse in out will create a file called out containing lines:

cba

gfed

ih

lkj

ponm

q

The program will contain a recursive method called public static String stringReverse( String s, int n)

This function will return a String that is the reversal of the first n characters of s.

Here's what I have so far. The while loop was supposed to read lines from in, extract, reverse and print tokens from each line.

*JAVA DATA STRUCTURES* Assignment: Write a program that takes two command line

Any help is appreciated, thanks

public class PileReverse public static String stringReverse (string s, int n) char c [ ] = s . toCharArray ( ) ; for ( int i = 0; i ") System.exit (1); open files in = new Scanner (new File (args [0])); out = new PrintWriter (new FileWriter (args [1] ) ) ; while (in.hasNextLine ))

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!