Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*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.

image text in transcribed

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

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

Database Design Using Entity Relationship Diagrams

Authors: Sikha Saha Bagui, Richard Walsh Earp

3rd Edition

103201718X, 978-1032017181

More Books

Students also viewed these Databases questions

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago