ELET 2300
Assignment 3
Submit your program through Blackboard – No late submissions!
Do not upload the books, only your main.cpp file
The task is to write a program using the computer language C++ that will help us
contrast two human languages: English and French.
To this end, we will analyze two language versions of the book "On the Origin of
Species", by Charles Darwin. The book is in the public domain and can be retrieved in
either language from the Gutenberg project:
http:
www.gutenberg.org/cache/epu
1228/pg1228.txt
http:
www.gutenberg.org/cache/epu
14158/pg14158.txt
Download the files to your computer. The files are in plain text. Have a peek by opening
each file with either Notepad or Wordpad. Then write a C++ program that works in the
following way:
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:
1. What it the total number of text lines in the file?
2. What it the number of text lines without any lower-case letter? To answer this
question, write and call the function testLowerCase.
3. What it the number of text lines without any number? To answer this question,
write and call the function testNumber.
4. 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.
5. What is the total number of letters (i.e., excluding symbols, numbers, etc.)? To
answer this question, write and call the function countLetters.
6. How many times each of the following punctuation symbols appear: comma,
period, double quotes, single quotes ?
7. What is the most popular letter (regardless of its case) ?
8. 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".
3. You need to write the functions testLowerCase, testNumber, countCharacters,
countLetters, which you will call from evaluateBook. The function's argument for each of
them is the cu
ent line from the textbook that is being processed (as a string). The
function then must return a boolean with the result of the test.
4. Call the function evaluateBook from main, first with the English version pg1228.txt
and then with the French version pg14158.txt so that we can contrast the results for
each language on the screen.
You must use only the C++ instructions that we have covered so far in class.
Notes:
- The program that you turn in must be your original and individual work. While
you are allowed to discuss the program assignments in general terms with others,
you are not allowed to share details of the actual solution(s) or program code
with anybody except the instructor.
- Turning in a copy of someone else's program, even a copy with extensive changes
made to it, or receiving any unauthorized assistance is a very serious offense in this
course.
- As needed, you can be asked to explain your solution in person anytime throughout
the semester.
- An automated plagiarism checker may scan programs at any time during the
semester. These checks may include all assignments, quizzes and exams.
- Only submit your source code (.cpp). This must be done on or before the due date
through Blackboard. No late submissions. Blackboard will automatically close the
submission page right after the deadline.
- Your program must include comments explaining your steps and must be properly
formatted (see Program_Style_Guidelines.pdf in Blackboard).
- Insert the following block at the top of your file with your information:
∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗
∗ ELET 2300
∗ Programming Assignment
∗
* Compiler name
∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗/