Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write in C#. I WILL THUMBS UP ON RATING!! Merge two or more text files provided by the user into a new text file

Please write in C#. I WILL THUMBS UP ON RATING!!

Merge two or more text files provided by the user into a new text file where the names of the text files to join and the output text file are provided to the program using command line arguments.

The names of the text files to join and the output text file are provided to the program using command line arguments. Instead of prompting the user for the names (paths to the files), that information is provided via command line arguments.

The command line arguments are provided to the Main() function in C#:

 class Program { static void Main(string[] args) { // args is a string[] of command line arguments } } 

The length of the array can be determined using the Length property of the array.

args.Length 

If two text files are to be merged, three command line arguments are supplied to the program. The first two command line arguments are the the names of the text files to merge and the third command line argument is the name of the resulting merged text file. In this case the args array of strings is to contain three strings.

If three text files are to be merged, four command line arguments are supplied to the program. The first three command line arguments are the the names of the text files to merge and the fourth command line argument is the name of the resulting merged text file. In this case the args array of strings is to contain four strings.

Support for merging two or more files is to be supported in the application. The number of command line arguments minus one is the number of text files to merge. If six text files are to be merged, seven command line arguments are supplied with the seventh being the name of the resulting merged text file.

If two command line arguments or less are supplied, then a merger of text documents is not possible. In this case the user is to be presented with information on how to use the program and the program is to exit (quit).

 if (args.Length < 3) { Console.WriteLine("DocumentMerger2 ... ") Console.WriteLine("Supply a list of text files to merge followed by the name of the resulting merged text file as command line arguments.") } If any exceptions occur during the execution of the program, they are to be handled and the user is to be presented with informative error messages. The program is not to crash when an exception occurs. An exception might occur if a provided filename doesnt exist or there is an error writing the output file.

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

Principles Of Multimedia Database Systems

Authors: V.S. Subrahmanian

1st Edition

1558604669, 978-1558604667

More Books

Students also viewed these Databases questions

Question

Know the three main dimensions of the service environment.

Answered: 1 week ago