1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
matrenka [14]
2 years ago
13

1. Define a C++ function with the name evaluateBook. The function receives as one argument the name of the file to be processed

(i.e., the book's file). So that if you pass the English version, we will see the results only for that language.
2. Function evaluateBook opens the file, reads it, analyzes it, and prints the answer to the following questions:



a. What it the total number of text lines in the file?

b. What it the number of text lines without any lower-case letter? To answer this question, write and call the function testLowerCase.

c. What it the number of text lines without any number? To answer this question, write and call the function testNumber.

d. What is the total number of visible characters (so, excluding invisible codes such as '\n') ? To answer this question, write and call the function countCharacters.

e. What is the total number of letters (i.e., excluding symbols, numbers, etc.)? To answer this question, write and call the function countLetters.

f. How many times each of the following punctuation symbols appear: comma, period, double quotes, single quotes ?

g. What is the most popular letter (regardless of its case) ? (update: assume it is a vowel)

h. The word "et" in French means "and". How many times does this word appear? The function should search for both words, so that if you pass the English version, the count for "et" will be likely zero. Also, ignore the case, but do not count a matching if part of another word, such as "Andrew".
Computers and Technology
1 answer:
katovenus [111]2 years ago
4 0

Answer:

#include <iostream>

#include<string>

#include<fstream>

using namespace std;

void evaluateBook(string bookName);

int countCharacters(string bookLine);

int countLetters(string bookLine);

int totalPunctuations(string bookLine);

int main()

{

  evaluateBook("demo-book.txt");

  return 0;

}

int countCharacters(string bookLine) {

  return bookLine.length();

}

int countLetters(string bookLine) {

  int counter = 0;

  for (int i = 0; i < bookLine.length(); i++) {

      if ((bookLine[i] >= 'a' && bookLine[i] <= 'z') || (bookLine[i] >= 'A' && bookLine[i] <= 'Z')) {

          counter++;

      }

  }

  return counter;

}

int totalPunctuations(string bookLine) {

  int counter = 0;

  for (int i = 0; i < bookLine.length(); i++) {

      if (bookLine[i]=='\.' || bookLine[i]=='\,' || bookLine[i]=='\"' || bookLine[i]=='\'') {

          counter++;

      }

  }

  return counter;

}

void evaluateBook(string bookName) {

  ifstream in(bookName);

  int totalVisibleCharacters = 0,totalLetters=0,numberOfPunctuations=0;

  if (!in) {

      cout << "File not found!!\n";

      exit(0);

  }

  string bookLine;

  while (getline(in, bookLine)) {

      totalVisibleCharacters += countCharacters(bookLine);

      totalLetters += countLetters(bookLine);

      numberOfPunctuations += totalPunctuations(bookLine);

  }

  cout << "Total Visible charcters count: "<<totalVisibleCharacters << endl;

  cout << "Total letters count: " << totalLetters << endl;

  cout << "Total punctuations count: " << numberOfPunctuations<< endl;

}

Explanation:

  • Create a function that takes a bookLine string as a parameter and returns total number of visible character.
  • Create a function that takes a bookLine string as a parameter and returns total number of letters.
  • Create a function that takes a bookLine string as a parameter and returns total number of punctuation.
  • Inside the evaluateBook function, read the file line by line and track all the information by calling all the above created functions.
  • Lastly, display the results.

You might be interested in
A network administrator has statically configured the LMI type on the interface of a Cisco router that is running Cisco IOS Rele
Sergeu [11.5K]

Answer:

The answer is "The LMI model should be compatible with the supplier dynamically for the network manager".

Explanation:

The term LMI stands for the "Local Management Interface", it is a Cisco technology, in which the signaling protocol was used in between routers and transmission frame switches to share data in timekeepers, global addressing, multipathing as well as the present state of virtual socks for various purposes, in which it is mainly used for "dynamically setting, in which the network administrator provides compatibility with the service provider".

8 0
3 years ago
Jhon bought a new printer for his desktop computer. It does not work even though he checked all the cables and cords. What do yo
ExtremeBDS [4]
Im not for sure but it might be B or C
4 0
2 years ago
Read 2 more answers
Your network consists of a single Active Directory domain. Your company has recently merged with another company. The acquired c
solmaris [256]

Answer:

Option E is correct.

Explanation:

While the user's server forms of the specific domain Active Directory. His corporation also partnered with some firms recently. The obtained corporation seems to have a multi-domain Active Directory server for both areas, both domain operators use the following Windows Servers. This was assigned the responsibility of proposing improvements to the Active Directory system.

He needs users of all corporations will gain exposure with each other's services, however, he wants to reduce logistical activity to achieve. Thus, he would build a two-way forest relationship between both the two roots forest domains.

6 0
2 years ago
I need help pleaseeee
MrRissso [65]

Answer:

Explanation:

I  ....

6 0
2 years ago
Name the box where the name of the first cell of the selected range appears?
sergey [27]

Answer:

Name box

Explanation:

From the picture, the name box is at the top left corner with B1 written inside, here B1 is written because it is the active cell at the time which also happens to be the first cell of the selected range. The name box can be used to easily create a named ranges rather Than having to draw the mouse over a group of cells. It also helps to know which cell is the current active cell as the cell address in the name box is the active cell at any point in time.

4 0
2 years ago
Other questions:
  • what is a massive online storage that allows for access by any Internet connected device running a web browser and is used for l
    7·1 answer
  • A _______________ is a security threat that may launch a worm through a Trojan horse or launch a denial-of-service attack at a t
    10·1 answer
  • Assume you are using the MINUS operator to combine the results from two tables with identical structure, CUSTOMER and CUSTOMER_2
    8·1 answer
  • The feature that moves text from the right edge of a paragraph to the beginning of the next line as necessary to fit within the
    12·1 answer
  • A 5-stage MIPS pipeline has a register file without forwarding mechanism. How many NOPs (or bubbles) will you need to add to mak
    9·1 answer
  • Count the number of words in the string. A word is one or more non-blank characters separated by one or more blanks. My suggesti
    13·1 answer
  • What are some ways to find out what skills you need to develop at work? Check all of the boxes that apply.
    15·2 answers
  • On the Format tab, which group allows you to select a different font for a chart?
    7·2 answers
  • Implement the function printTwoLargest that inputs an arbitrary number of positive numbers from the user. The input of numbers s
    14·1 answer
  • What is operating system​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!