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.