Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Write a Java program that accepts the names of a set of files while it is started from the command line and processes these files as specified below. (a) The user must supply at least two file names....

1 answer below »

Write a Java program that accepts the names of a set of files while it is started

from the command line and processes these files as specified below.

(a) The user must supply at least two file names. Thus, the following are among

the infinite number of valid commands.

java Processor infile outfile

java Processor infile1 infile2 outfile

java Processor infilea infileb infilec myoutfile

The following are invalid.

java Processor

java Processor fileName

For invalid commands, the program prints an error message and terminates.

(b) The very last parameter is the name of an output file. All the other file names

are input files. All are pure text files (no binary data) and you may assume

that the output file is also not specified as an input file. Thus, you do not have

to worry about situations such as

java Processor infilea infileb infilec infileb

(c) Each of the input files is read and copied to the output. The files are opened

and read in the specified order.

(d) If one of the input files is missing, it is skipped and the next input file, if any,

is processed.

(e) If there is a problem opening the output file, the program displays an error

message and exits.

(f) Each line of each input file is read and copied to the output file. Just prior to

copying a line to the output, the name of the input file, the line number in the

input file and the line number in the output file are all given as output.

Answered 78 days After Jan 10, 2022

Solution

Vaibhav answered on Mar 29 2022
107 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here