Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. For this homework, you will design, implement, and test a program that prompts the user for two file names. The first will be the

1. For this homework, you will design, implement, and test a program that prompts the user for two file names. The first will be the name of a text file containing the English dictionary (see JustWords!, http://www.gwicks.net/dictionaries.htm). The second file name will be the name of the output file. The dictionary file should be formatted as a plain text file with a single word on each line and must contain at least one word (line). The output file, if it exists, will be overwritten by this program.

If an error occurs while attempting to open the dictionary file or if the file does not have at least one line, the program shall display an informative and appropriate error message and prompt the user to re-enter a name. This should continue until a user enters the name of a valid dictionary file.

The program will then then cycle through the dictionary file to find compound words. A compound word is defined as a word (in the dictionary) that contains two other words that are also in the dictionary. Your program should write these compound words out to the output text file, along with the two words that compose it. For example, "raincoat" is a compound word, so one line in the output file should be "raincoat = rain + coat". The final line of the output file should be an integer value indicating how many compound words were found. Note that the time required for this program to execute will be sensitive to the size of the dictionary.

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Why is it difficult to cure AIDS patients of a fungal infection?

Answered: 1 week ago

Question

Are we being responsive to current business priorities?

Answered: 1 week ago

Question

WHAT IS AUTOMATION TESTING?

Answered: 1 week ago

Question

Question What is the doughnut hole in HSA coverage?

Answered: 1 week ago