SlideShare a Scribd company logo
1 of 15
For this assignment, download the
A6 code pack
. This zip file contains several files:
main.cpp
- the predetermined main.cpp. This file shows the usage and
functionality that is expected of your program. You are not
allowed to edit this file. You will not be submitting this file
with your assignment.
CMakeLists.txt
- the preset CMake file to build with your functions files.
input/greeneggsandham.txt
- the contents of Green Eggs and Ham in text format.
input/aliceChapter1.txt
- the first chapter of Alice in Wonderland in text format.
output/greeneggsandham.out
- the expected output when running your program against the
greeneggsandham.txt
file
output/aliceChapter1.out
- the expected output when running your program against the
aliceChapter1.txt
file
Your task is to provide the implementations for all of the
referenced functions. You will need to create two files:
functions.h
and
functions.cpp
to make the program work as intended.
You will want to make your program as general as possible by
not having any assumptions about the data hardcoded in. Two
public input files have been supplied with the starter pack. We
will run your program against a third private input file.
Function Requirements
The requirements of each function are given below. The input,
output, and task of each function is described. The functions
are:
promptUserForFilename()
openFile()
readWordsFromFile()
removePunctuation()
capitalizeWords()
filterUniqueWords()
alphabetizeWords()
countUniqueWords()
printWordsAndCounts()
countLetters()
printLetterCounts()
printMaxMinWord()
printMaxMinLetter()
promptUserForFilename()
Input
: None
Output
: A string
Task
: Prompt the user to enter a filename.
openFile()
Input
: (1) The input file stream (2) The string filename to open
Output
: True if the file successfully opened, False if the file could not
be opened
Task
: Open the input file stream for the corresponding filename.
Check that the file opened correctly. The string filename will
remain unchanged.
readWordsFromFile()
Input
: The input file stream
Output
: A vector of strings
Task
: Read all of the words that are in the filestream and return a list
of all the words in the order present in the file.
removePunctuation()
Input
: (1) A vector of strings (2) A string of all the punctuation
characters to remove
Output
: None
Task
: For each word in the vector, remove all occurrences of all the
punctuation characters denoted by the punctuation string. When
complete, the input vector will now hold all the words with
punctuation removed. The punctuation string will remain
unchanged.
capitalizeWords()
Input
: A vector of strings
Output
: None
Task
: For each word in the vector, convert each character to its
upper case equivalent. When complete, the input vector will
now hold all the words capitalized.
filterUniqueWords()
Input
: A vector of strings
Output
: A vector of strings
Task
: The function will return only the unique words present in the
input vector. The output vector will not contain any duplicate
words.
alphabetizeWords()
Input
: A vector of strings
Output
: None
Task
: Sort the strings in the input vector alphabetically. When
complete, the input vector have the same length and contents
but reordered so that the contents are in alphabetical order.
countUniqueWords()
Input
: (1) A vector of strings representing all of the words in the file
(2) A vector of strings representing only the unique words in the
file
Output
: A vector of unsigned integers
Task
: For every unique word in the list, count the number of
occurrences the unique word is present in the full text. Return a
vector of all the counts. Each position in the vector of counts
corresponds to the same position in the unique word list. The
vector of counts will have the same size as the vector of unique
words. Upon completion, neither input vector will be modified.
printWordsAndCounts()
Input
: (1) A vector of strings (2) A vector of unsigned integers
Output
: None
Task
: For each word and count in the vectors, print out the word and
its corresponding count. Upon completion, the two vectors will
remain unchanged. Format the output as follows:
#P : ABCDEF : #C
Notice how there are three columns separated by
:
. We want the
:
aligned in every row and the values aligned in each column.
The columns correspond to the following values:
#P
- The position the word in the list. Begin at 1. Right align all
values. Allocate enough space for the length of the last position.
(If there are less than 10 numbers, then we need only 1 space. If
there are less than 100 numbers, then we need only 2 spaces.
And so on. Assume there will be at most 109 unique words.)
ABCEDF
- The unique word. Left align all values. Allocate enough space
for the longest word present in the list.
#C
- The corresponding count of the unique word. Right align all
values. Allocate enough space for the length of the largest
number. (Assume there will be at most 109 unique words.)
An example with actual values is shown below:
1 : BIRTHDAY : 4
2 : BJORNE : 1
3 : HAPPY : 4
4 : TO : 4
5 : YOU : 3
Refer to the expected output files for longer examples on the
expected formatting.
countLetters()
Input
: (1) An array of 26 unsigned integers (2) A vector of strings
Output
: None
Task
: Count the number of occurrences of each letter present in all
words. Each position of the array corresponds to each letter as
ordered by the English alphabet. Upon completion, the array
will hold the counts of each letter and the vector of strings will
remain unchanged.
printLetterCounts()
Input
: An array of 26 unsigned integers
Output
: None
Task
: For each letter, print out the letter and its corresponding
count. Format the output as follows:
A : #C
B : #C
...
Y : #C
Z : #C
Notice how there are two columns separated by :. We want the :
aligned in every row and the values aligned in each column. The
columns correspond to the following values:
A
- The letter
#C
- The corresponding count of the letter. Right align all values.
Allocate enough space for the length of the largest number.
(Assume there will be at most 109 unique words.)
An example with actual values is shown below:
A : 8
B : 5
C : 0
D : 4
E : 1
F : 0
G : 0
H : 8
I : 4
J : 1
K : 0
L : 0
M : 0
N : 1
O : 8
P : 8
Q : 0
R : 5
S : 0
T : 8
U : 3
V : 0
W : 0
X : 0
Y : 11
Z : 0
Refer to the expected output files for longer examples on the
expected formatting.
printMaxMinWord()
Input
: (1) A vector of strings (2) A vector of unsigned integers
Output
: None
Task
: Print out the two words that occur least often and most often.
If there is more than one word that occurs the same number of
times, print the one that comes first alphabetically. Upon
completion, both input vectors will remain unchanged. Print out
the following pieces of information:
The word
The number of occurrences
The frequency of appearance as a percentage to 3 decimal
places
Format the output as follows:
Least Frequent Word: ABCDEF #C (#P%)
Most Frequent Word: ABCDEF #C (#P%)
Notice how there are three columns of values. The columns
correspond to the following values:
ABCEDF
- The word. Left align all values. Allocate enough space for the
longer of the two words.
#C
- The corresponding count of the word. Right align all values.
Allocate enough space for the length of the larger number.
(Assume there will be at most 109 unique words.)
#P
- The frequency of the word. Right align all values. Print to
three decimal places.
An example with actual values is shown below:
Least Frequent Word: BJORNE 1 ( 6.250%)
Most Frequent Word: BIRTHDAY 4 ( 25.000%)
Refer to the expected output files for longer examples on the
expected formatting.
printMaxMinLetter()
Input
: An array of 26 unsigned integers
Output
: None
Task
: Print out the two letters that occur least often and most often.
If there is more than one letter that occurs the same number of
times, print the one that comes first alphabetically. Upon
completion, the input array will remain unchanged. Print out the
following pieces of information:
The letter
The number of occurrences
The frequency of appearance as a percentage to 3 decimal
places
Format the output as follows:
Least Frequent Letter: A #C (#P%)
Most Frequent Letter: Z #C (#P%)
Notice how there are three columns of values. The columns
correspond to the following values:
A
- The letter.
#C
- The corresponding count of the letter. Right align all values.
Allocate enough space for the length of the larger number.
(Assume there will be at most 109 occurrences.)
#P
- The frequency of the letter. Right align all values. Print to
three decimal places.
An example with actual values is shown below:
Least Frequent Letter: C 0 ( 0.000%)
Most Frequent Letter: Y 11 ( 14.667%)
Refer to the expected output files for longer examples on the
expected formatting.
Functional Requirements
You may not make use of the standard library functions sort(),
find(), any_of() or anything else from #include . You must
implement your own sorting and searching functions.
DO NOT use global variables.
You must use parameters properly, either pass-by-value or pass-
by-reference.
Do not use any global variables. You must use parameters
properly.
Mark parameters as const appropriately if the function is not
modifying the parameter value.
For this assignment, the output must match the example outputs
exactly.
For this assignment, only submit your
functions.h
and
functions.cpp
files. Do not include
main.cpp
,
CMakeLists.txt
, or any of the other input/output files.

More Related Content

Similar to For this assignment, download the A6 code pack. This zip fil.docx

Programming fundamental
Programming fundamentalProgramming fundamental
Programming fundamentalMukesh Thakur
 
Type header file in c++ and its function
Type header file in c++ and its functionType header file in c++ and its function
Type header file in c++ and its functionFrankie Jones
 
Strings in c mrs.sowmya jyothi
Strings in c mrs.sowmya jyothiStrings in c mrs.sowmya jyothi
Strings in c mrs.sowmya jyothiSowmya Jyothi
 
Lab6: I/O and Arrays
Lab6: I/O and ArraysLab6: I/O and Arrays
Lab6: I/O and Arraysenidcruz
 
Matlab: Procedures And Functions
Matlab: Procedures And FunctionsMatlab: Procedures And Functions
Matlab: Procedures And Functionsmatlab Content
 
Procedures And Functions in Matlab
Procedures And Functions in MatlabProcedures And Functions in Matlab
Procedures And Functions in MatlabDataminingTools Inc
 
Python programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operationsPython programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operationsMegha V
 
String in programming language in c or c++
 String in programming language  in c or c++  String in programming language  in c or c++
String in programming language in c or c++ Samsil Arefin
 
stringsinpython-181122100212.pdf
stringsinpython-181122100212.pdfstringsinpython-181122100212.pdf
stringsinpython-181122100212.pdfpaijitk
 
Strings.pptx
Strings.pptxStrings.pptx
Strings.pptxYagna15
 
Chapter2CDpdf__2021_11_26_09_19_08.pdf
Chapter2CDpdf__2021_11_26_09_19_08.pdfChapter2CDpdf__2021_11_26_09_19_08.pdf
Chapter2CDpdf__2021_11_26_09_19_08.pdfDrIsikoIsaac
 

Similar to For this assignment, download the A6 code pack. This zip fil.docx (20)

Python ppt
Python pptPython ppt
Python ppt
 
Programming fundamental
Programming fundamentalProgramming fundamental
Programming fundamental
 
Type header file in c++ and its function
Type header file in c++ and its functionType header file in c++ and its function
Type header file in c++ and its function
 
Strings in c mrs.sowmya jyothi
Strings in c mrs.sowmya jyothiStrings in c mrs.sowmya jyothi
Strings in c mrs.sowmya jyothi
 
Lab6: I/O and Arrays
Lab6: I/O and ArraysLab6: I/O and Arrays
Lab6: I/O and Arrays
 
Matlab: Procedures And Functions
Matlab: Procedures And FunctionsMatlab: Procedures And Functions
Matlab: Procedures And Functions
 
Procedures And Functions in Matlab
Procedures And Functions in MatlabProcedures And Functions in Matlab
Procedures And Functions in Matlab
 
Compilers Design
Compilers DesignCompilers Design
Compilers Design
 
Python slide.1
Python slide.1Python slide.1
Python slide.1
 
Python reference
Python referencePython reference
Python reference
 
Python programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operationsPython programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operations
 
string in C
string in Cstring in C
string in C
 
String in programming language in c or c++
 String in programming language  in c or c++  String in programming language  in c or c++
String in programming language in c or c++
 
stringsinpython-181122100212.pdf
stringsinpython-181122100212.pdfstringsinpython-181122100212.pdf
stringsinpython-181122100212.pdf
 
Strings in python
Strings in pythonStrings in python
Strings in python
 
Strings.pptx
Strings.pptxStrings.pptx
Strings.pptx
 
PHP Web Programming
PHP Web ProgrammingPHP Web Programming
PHP Web Programming
 
C string
C stringC string
C string
 
Chapter2CDpdf__2021_11_26_09_19_08.pdf
Chapter2CDpdf__2021_11_26_09_19_08.pdfChapter2CDpdf__2021_11_26_09_19_08.pdf
Chapter2CDpdf__2021_11_26_09_19_08.pdf
 
LISP: Data types in lisp
LISP: Data types in lispLISP: Data types in lisp
LISP: Data types in lisp
 

More from alfred4lewis58146

For this assignment, students will need to observe the activities th.docx
For this assignment, students will need to observe the activities th.docxFor this assignment, students will need to observe the activities th.docx
For this assignment, students will need to observe the activities th.docxalfred4lewis58146
 
For this assignment, select a human service organization from .docx
For this assignment, select a human service organization from .docxFor this assignment, select a human service organization from .docx
For this assignment, select a human service organization from .docxalfred4lewis58146
 
For this Assignment, read the case study for Claudia and find tw.docx
For this Assignment, read the case study for Claudia and find tw.docxFor this Assignment, read the case study for Claudia and find tw.docx
For this Assignment, read the case study for Claudia and find tw.docxalfred4lewis58146
 
For this assignment, create infographic using the Canva website..docx
For this assignment, create infographic using the Canva website..docxFor this assignment, create infographic using the Canva website..docx
For this assignment, create infographic using the Canva website..docxalfred4lewis58146
 
For this assignment, compare  California during the Great Depression.docx
For this assignment, compare  California during the Great Depression.docxFor this assignment, compare  California during the Great Depression.docx
For this assignment, compare  California during the Great Depression.docxalfred4lewis58146
 
For this assignment, create a 10- to 12-slide presentation in Mi.docx
For this assignment, create a 10- to 12-slide presentation in Mi.docxFor this assignment, create a 10- to 12-slide presentation in Mi.docx
For this assignment, create a 10- to 12-slide presentation in Mi.docxalfred4lewis58146
 
For this assignment, begin by reading chapters 12-15 in Dr. Bells t.docx
For this assignment, begin by reading chapters 12-15 in Dr. Bells t.docxFor this assignment, begin by reading chapters 12-15 in Dr. Bells t.docx
For this assignment, begin by reading chapters 12-15 in Dr. Bells t.docxalfred4lewis58146
 
For this assignment, assume you are the new Secretary of Homelan.docx
For this assignment, assume you are the new Secretary of Homelan.docxFor this assignment, assume you are the new Secretary of Homelan.docx
For this assignment, assume you are the new Secretary of Homelan.docxalfred4lewis58146
 
For this assignment, address the following promptsIntroductor.docx
For this assignment, address the following promptsIntroductor.docxFor this assignment, address the following promptsIntroductor.docx
For this assignment, address the following promptsIntroductor.docxalfred4lewis58146
 
For this assignment, analyze the play by focusing on one of the .docx
For this assignment, analyze the play by focusing on one of the .docxFor this assignment, analyze the play by focusing on one of the .docx
For this assignment, analyze the play by focusing on one of the .docxalfred4lewis58146
 
For this assignment I would like you to answer these questions.docx
For this assignment I would like you to answer these questions.docxFor this assignment I would like you to answer these questions.docx
For this assignment I would like you to answer these questions.docxalfred4lewis58146
 
For the Weekly Reports I need 2 reports. For the First two weeks the.docx
For the Weekly Reports I need 2 reports. For the First two weeks the.docxFor the Weekly Reports I need 2 reports. For the First two weeks the.docx
For the Weekly Reports I need 2 reports. For the First two weeks the.docxalfred4lewis58146
 
For the shortanswer questions,you will need to respo.docx
For the shortanswer questions,you will need to respo.docxFor the shortanswer questions,you will need to respo.docx
For the shortanswer questions,you will need to respo.docxalfred4lewis58146
 
For the sake of argument (this essay in particular), lets prete.docx
For the sake of argument (this essay in particular), lets prete.docxFor the sake of argument (this essay in particular), lets prete.docx
For the sake of argument (this essay in particular), lets prete.docxalfred4lewis58146
 
For the proposal, each student must describe an interface they a.docx
For the proposal, each student must describe an interface they a.docxFor the proposal, each student must describe an interface they a.docx
For the proposal, each student must describe an interface they a.docxalfred4lewis58146
 
For the project, you will be expected to apply the key concepts of p.docx
For the project, you will be expected to apply the key concepts of p.docxFor the project, you will be expected to apply the key concepts of p.docx
For the project, you will be expected to apply the key concepts of p.docxalfred4lewis58146
 
For the past several weeks you have addressed several different area.docx
For the past several weeks you have addressed several different area.docxFor the past several weeks you have addressed several different area.docx
For the past several weeks you have addressed several different area.docxalfred4lewis58146
 
For the Mash it Up assignment, we experimented with different ways t.docx
For the Mash it Up assignment, we experimented with different ways t.docxFor the Mash it Up assignment, we experimented with different ways t.docx
For the Mash it Up assignment, we experimented with different ways t.docxalfred4lewis58146
 
For the first time in modern history, the world is experiencing a he.docx
For the first time in modern history, the world is experiencing a he.docxFor the first time in modern history, the world is experiencing a he.docx
For the first time in modern history, the world is experiencing a he.docxalfred4lewis58146
 
For the following question, use this passage .docx
For the following question, use this passage                     .docxFor the following question, use this passage                     .docx
For the following question, use this passage .docxalfred4lewis58146
 

More from alfred4lewis58146 (20)

For this assignment, students will need to observe the activities th.docx
For this assignment, students will need to observe the activities th.docxFor this assignment, students will need to observe the activities th.docx
For this assignment, students will need to observe the activities th.docx
 
For this assignment, select a human service organization from .docx
For this assignment, select a human service organization from .docxFor this assignment, select a human service organization from .docx
For this assignment, select a human service organization from .docx
 
For this Assignment, read the case study for Claudia and find tw.docx
For this Assignment, read the case study for Claudia and find tw.docxFor this Assignment, read the case study for Claudia and find tw.docx
For this Assignment, read the case study for Claudia and find tw.docx
 
For this assignment, create infographic using the Canva website..docx
For this assignment, create infographic using the Canva website..docxFor this assignment, create infographic using the Canva website..docx
For this assignment, create infographic using the Canva website..docx
 
For this assignment, compare  California during the Great Depression.docx
For this assignment, compare  California during the Great Depression.docxFor this assignment, compare  California during the Great Depression.docx
For this assignment, compare  California during the Great Depression.docx
 
For this assignment, create a 10- to 12-slide presentation in Mi.docx
For this assignment, create a 10- to 12-slide presentation in Mi.docxFor this assignment, create a 10- to 12-slide presentation in Mi.docx
For this assignment, create a 10- to 12-slide presentation in Mi.docx
 
For this assignment, begin by reading chapters 12-15 in Dr. Bells t.docx
For this assignment, begin by reading chapters 12-15 in Dr. Bells t.docxFor this assignment, begin by reading chapters 12-15 in Dr. Bells t.docx
For this assignment, begin by reading chapters 12-15 in Dr. Bells t.docx
 
For this assignment, assume you are the new Secretary of Homelan.docx
For this assignment, assume you are the new Secretary of Homelan.docxFor this assignment, assume you are the new Secretary of Homelan.docx
For this assignment, assume you are the new Secretary of Homelan.docx
 
For this assignment, address the following promptsIntroductor.docx
For this assignment, address the following promptsIntroductor.docxFor this assignment, address the following promptsIntroductor.docx
For this assignment, address the following promptsIntroductor.docx
 
For this assignment, analyze the play by focusing on one of the .docx
For this assignment, analyze the play by focusing on one of the .docxFor this assignment, analyze the play by focusing on one of the .docx
For this assignment, analyze the play by focusing on one of the .docx
 
For this assignment I would like you to answer these questions.docx
For this assignment I would like you to answer these questions.docxFor this assignment I would like you to answer these questions.docx
For this assignment I would like you to answer these questions.docx
 
For the Weekly Reports I need 2 reports. For the First two weeks the.docx
For the Weekly Reports I need 2 reports. For the First two weeks the.docxFor the Weekly Reports I need 2 reports. For the First two weeks the.docx
For the Weekly Reports I need 2 reports. For the First two weeks the.docx
 
For the shortanswer questions,you will need to respo.docx
For the shortanswer questions,you will need to respo.docxFor the shortanswer questions,you will need to respo.docx
For the shortanswer questions,you will need to respo.docx
 
For the sake of argument (this essay in particular), lets prete.docx
For the sake of argument (this essay in particular), lets prete.docxFor the sake of argument (this essay in particular), lets prete.docx
For the sake of argument (this essay in particular), lets prete.docx
 
For the proposal, each student must describe an interface they a.docx
For the proposal, each student must describe an interface they a.docxFor the proposal, each student must describe an interface they a.docx
For the proposal, each student must describe an interface they a.docx
 
For the project, you will be expected to apply the key concepts of p.docx
For the project, you will be expected to apply the key concepts of p.docxFor the project, you will be expected to apply the key concepts of p.docx
For the project, you will be expected to apply the key concepts of p.docx
 
For the past several weeks you have addressed several different area.docx
For the past several weeks you have addressed several different area.docxFor the past several weeks you have addressed several different area.docx
For the past several weeks you have addressed several different area.docx
 
For the Mash it Up assignment, we experimented with different ways t.docx
For the Mash it Up assignment, we experimented with different ways t.docxFor the Mash it Up assignment, we experimented with different ways t.docx
For the Mash it Up assignment, we experimented with different ways t.docx
 
For the first time in modern history, the world is experiencing a he.docx
For the first time in modern history, the world is experiencing a he.docxFor the first time in modern history, the world is experiencing a he.docx
For the first time in modern history, the world is experiencing a he.docx
 
For the following question, use this passage .docx
For the following question, use this passage                     .docxFor the following question, use this passage                     .docx
For the following question, use this passage .docx
 

Recently uploaded

Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 

Recently uploaded (20)

Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 

For this assignment, download the A6 code pack. This zip fil.docx

  • 1. For this assignment, download the A6 code pack . This zip file contains several files: main.cpp - the predetermined main.cpp. This file shows the usage and functionality that is expected of your program. You are not allowed to edit this file. You will not be submitting this file with your assignment. CMakeLists.txt - the preset CMake file to build with your functions files. input/greeneggsandham.txt - the contents of Green Eggs and Ham in text format. input/aliceChapter1.txt - the first chapter of Alice in Wonderland in text format. output/greeneggsandham.out - the expected output when running your program against the greeneggsandham.txt file output/aliceChapter1.out - the expected output when running your program against the aliceChapter1.txt file
  • 2. Your task is to provide the implementations for all of the referenced functions. You will need to create two files: functions.h and functions.cpp to make the program work as intended. You will want to make your program as general as possible by not having any assumptions about the data hardcoded in. Two public input files have been supplied with the starter pack. We will run your program against a third private input file. Function Requirements The requirements of each function are given below. The input, output, and task of each function is described. The functions are: promptUserForFilename() openFile() readWordsFromFile() removePunctuation() capitalizeWords() filterUniqueWords() alphabetizeWords() countUniqueWords() printWordsAndCounts()
  • 3. countLetters() printLetterCounts() printMaxMinWord() printMaxMinLetter() promptUserForFilename() Input : None Output : A string Task : Prompt the user to enter a filename. openFile() Input : (1) The input file stream (2) The string filename to open Output : True if the file successfully opened, False if the file could not be opened Task : Open the input file stream for the corresponding filename.
  • 4. Check that the file opened correctly. The string filename will remain unchanged. readWordsFromFile() Input : The input file stream Output : A vector of strings Task : Read all of the words that are in the filestream and return a list of all the words in the order present in the file. removePunctuation() Input : (1) A vector of strings (2) A string of all the punctuation characters to remove Output : None Task : For each word in the vector, remove all occurrences of all the punctuation characters denoted by the punctuation string. When complete, the input vector will now hold all the words with punctuation removed. The punctuation string will remain unchanged. capitalizeWords()
  • 5. Input : A vector of strings Output : None Task : For each word in the vector, convert each character to its upper case equivalent. When complete, the input vector will now hold all the words capitalized. filterUniqueWords() Input : A vector of strings Output : A vector of strings Task : The function will return only the unique words present in the input vector. The output vector will not contain any duplicate words. alphabetizeWords() Input : A vector of strings Output
  • 6. : None Task : Sort the strings in the input vector alphabetically. When complete, the input vector have the same length and contents but reordered so that the contents are in alphabetical order. countUniqueWords() Input : (1) A vector of strings representing all of the words in the file (2) A vector of strings representing only the unique words in the file Output : A vector of unsigned integers Task : For every unique word in the list, count the number of occurrences the unique word is present in the full text. Return a vector of all the counts. Each position in the vector of counts corresponds to the same position in the unique word list. The vector of counts will have the same size as the vector of unique words. Upon completion, neither input vector will be modified. printWordsAndCounts() Input : (1) A vector of strings (2) A vector of unsigned integers Output : None
  • 7. Task : For each word and count in the vectors, print out the word and its corresponding count. Upon completion, the two vectors will remain unchanged. Format the output as follows: #P : ABCDEF : #C Notice how there are three columns separated by : . We want the : aligned in every row and the values aligned in each column. The columns correspond to the following values: #P - The position the word in the list. Begin at 1. Right align all values. Allocate enough space for the length of the last position. (If there are less than 10 numbers, then we need only 1 space. If there are less than 100 numbers, then we need only 2 spaces. And so on. Assume there will be at most 109 unique words.) ABCEDF - The unique word. Left align all values. Allocate enough space for the longest word present in the list. #C - The corresponding count of the unique word. Right align all values. Allocate enough space for the length of the largest number. (Assume there will be at most 109 unique words.) An example with actual values is shown below:
  • 8. 1 : BIRTHDAY : 4 2 : BJORNE : 1 3 : HAPPY : 4 4 : TO : 4 5 : YOU : 3 Refer to the expected output files for longer examples on the expected formatting. countLetters() Input : (1) An array of 26 unsigned integers (2) A vector of strings Output : None Task : Count the number of occurrences of each letter present in all words. Each position of the array corresponds to each letter as ordered by the English alphabet. Upon completion, the array will hold the counts of each letter and the vector of strings will remain unchanged. printLetterCounts() Input : An array of 26 unsigned integers
  • 9. Output : None Task : For each letter, print out the letter and its corresponding count. Format the output as follows: A : #C B : #C ... Y : #C Z : #C Notice how there are two columns separated by :. We want the : aligned in every row and the values aligned in each column. The columns correspond to the following values: A - The letter #C - The corresponding count of the letter. Right align all values. Allocate enough space for the length of the largest number. (Assume there will be at most 109 unique words.) An example with actual values is shown below: A : 8
  • 10. B : 5 C : 0 D : 4 E : 1 F : 0 G : 0 H : 8 I : 4 J : 1 K : 0 L : 0 M : 0 N : 1 O : 8 P : 8 Q : 0 R : 5 S : 0
  • 11. T : 8 U : 3 V : 0 W : 0 X : 0 Y : 11 Z : 0 Refer to the expected output files for longer examples on the expected formatting. printMaxMinWord() Input : (1) A vector of strings (2) A vector of unsigned integers Output : None Task : Print out the two words that occur least often and most often. If there is more than one word that occurs the same number of times, print the one that comes first alphabetically. Upon completion, both input vectors will remain unchanged. Print out the following pieces of information: The word
  • 12. The number of occurrences The frequency of appearance as a percentage to 3 decimal places Format the output as follows: Least Frequent Word: ABCDEF #C (#P%) Most Frequent Word: ABCDEF #C (#P%) Notice how there are three columns of values. The columns correspond to the following values: ABCEDF - The word. Left align all values. Allocate enough space for the longer of the two words. #C - The corresponding count of the word. Right align all values. Allocate enough space for the length of the larger number. (Assume there will be at most 109 unique words.) #P - The frequency of the word. Right align all values. Print to three decimal places. An example with actual values is shown below: Least Frequent Word: BJORNE 1 ( 6.250%) Most Frequent Word: BIRTHDAY 4 ( 25.000%)
  • 13. Refer to the expected output files for longer examples on the expected formatting. printMaxMinLetter() Input : An array of 26 unsigned integers Output : None Task : Print out the two letters that occur least often and most often. If there is more than one letter that occurs the same number of times, print the one that comes first alphabetically. Upon completion, the input array will remain unchanged. Print out the following pieces of information: The letter The number of occurrences The frequency of appearance as a percentage to 3 decimal places Format the output as follows: Least Frequent Letter: A #C (#P%) Most Frequent Letter: Z #C (#P%)
  • 14. Notice how there are three columns of values. The columns correspond to the following values: A - The letter. #C - The corresponding count of the letter. Right align all values. Allocate enough space for the length of the larger number. (Assume there will be at most 109 occurrences.) #P - The frequency of the letter. Right align all values. Print to three decimal places. An example with actual values is shown below: Least Frequent Letter: C 0 ( 0.000%) Most Frequent Letter: Y 11 ( 14.667%) Refer to the expected output files for longer examples on the expected formatting. Functional Requirements You may not make use of the standard library functions sort(), find(), any_of() or anything else from #include . You must implement your own sorting and searching functions. DO NOT use global variables. You must use parameters properly, either pass-by-value or pass-
  • 15. by-reference. Do not use any global variables. You must use parameters properly. Mark parameters as const appropriately if the function is not modifying the parameter value. For this assignment, the output must match the example outputs exactly. For this assignment, only submit your functions.h and functions.cpp files. Do not include main.cpp , CMakeLists.txt , or any of the other input/output files.