Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Main.java public static void main(final String[] args): Use the commandline arguments to specify a textfile name to save the results of the program described below.

Main.java

public static void main(final String[] args):

Use the commandline arguments to specify a textfile name to save the results of the program described below. The filename must be 20 or fewer characters and end with a ".txt" file extension. If the commandline argument is not provided, throw a MissingFileName checked Exception (you make this class). If the commandline argument does not meet the specifications above, throw an InvalidFileName unchecked exception (you make this class).

Work with the "firstnames.txt" and "fullnames.txt" text files provided along with these lab 6 requirements.

Using the firstnames.txt file, open the file for reading. Then create a textfile for each name in the firstnames.txt. For example, if firstnames.txt contains this data...

Tiger

Jason

Bill

Mary

Tom

...then your program must create five text files:

Tiger.txt

Jason.txt

Bill.txt

Mary.txt

Tom.txt

The contents of each file must be the person's name a certain number of times. "Tiger" has five letters, so the Tiger.txt file must have the String "Tiger" five times, once per line:

Tiger

Tiger

Tiger

Tiger

Tiger

"Tom" has three letters, so the Tom.txt file must have the String "Tom" three times, once per line:

Tom

Tom

Tom

...repeat for all of the names in the firstnames.txt file.

The output file (whose name was specified as a commandline argument) contains a list of all the first names from firstnames.txt that are also in fullnames.txt. For example, Tom is in both files so it must be in the output file. Tiger is not in both files so it must not be in 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

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions

Question

Organizing Your Speech Points

Answered: 1 week ago