Menu

[Solved]-Using C Write Program Reads Report Running Text Issues Warnings Style Following Features S Q37174544

Using C++

Write a program that reads a report (running text), issueswarnings on style with the following features.

Statistics

A statistical summary is prepared for each report processed withthe following information:

• total number of words in the report;

• number of unique words;

• number of unique words of more than four letters;

• a listing of the special words with the number of times eachwas used in the report.

Style Warnings

Issue a warning in the following cases:

• Word used too often: List each unique word of more than fourletters if its usage is more than 5% of the total number of wordsof more than three letters.

Run Summary

At the end of the run the special words are written to the filewith the number of times each was used during the run of theprogram.

Input From the keyboard:

1. The name of the file containing the text to be analyzed

2. List of special words From the file: The report to beanalyzed; ended by  <eof>. Allow the user tocontinue with another file name or quit.

Output

1. For each report being analyzed write the followinginformation to a file.

• The name of the file

• A listing of the file

• The statistical summary of the report (See Statisticsabove.)

• The style warnings given (See Style Warnings above.)

2. An alphabetical listing of the special words one per linewith the number of times each was used throughout the run of theprogram.

Data Structures

1. A list to contain the special words

2. A list of unique words in the report, created as the file isread. If a word is not in the list, put it there. If it is,increment a counter showing how many times the word has beenused.

Word : Sequence of letters ending in a blank, a period, anexclamation point, a question mark, a colon, a comma, a singlequote, a double quote, or a semicolon. Numbers do not appear in thewords; they may be ignored.

Unique word: Words that are spelled the same, ignoring uppercaseand lowercase distinctions.

Sentence : Words between end of sentence markers or thebeginning of the report and the first end of sentence marker.

Below is the sample text we are supposed to put into the program(just put into wordpad text):

The brown rat’s teeth are yellow, the front two incisors being especially long and sharp, like buckteeth. When the brown rat bites, its front two teeth spread apart. When it gnaws, a flap of skin plugs the space behind its incisors. Hence, when the rat gnaws on indigestible materials—concrete or steel, for example—the shavings don’t go down the rat’s throat and kill it. Its incisors grow at a rate of five inches per year. Rats always gnaw, and no one is certain why—there are few modern rat studies. It is sometimes erroneously stated that the rat gnaws solely to limit the length of its incisors, which would otherwise grow out of its head, but this is not the case: the incisors wear down naturally. In terms of hardness, the brown rat’s teeth are stronger than aluminum, copper, lead, and iron. They are comparable to steel. With the alligator-like structure of their jaws, rats can exert a biting pressure of up to seven thousand pounds per square inch. Rats, like mice, seem to be attracted to wires—to utility wires, computer wires, wires in vehicles, in addition to gas and water pipes. One rat expert theorizes that wires may be attractive to rats because of their resemblance to vines and the stalks of plants; cables are the vines of the city. By one estimate, 26 percent of all electric-cable breaks and 18 percent of all phone-cable disruptions are caused by rats. According to one study, as many as 25 percent of all fires of unknown origin are rat-caused. Rats chew electrical cables. Sitting in a nest of tattered rags and newspapers, in the floorboards of an old tenement, a rat gnaws the head of a match—the lightning in the city forest.<eof>

Expert Answer


Answer to Using C++ Write a program that reads a report (running text), issues warnings on style with the following features. Stat… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *