C++ Programming Code

Nov 10th, 2014
HelloWorld
Category:
Computer Science
Price: $30 USD

Question description

Hi,

Here's a description of the code:

For this assignment you will be writing a function: 

LetterCounter countLetters(int numStrings, char** stringList).

The return type is a class named LetterCounter (more on this later) containing an array with the counts for each of the 26 letters, normalized to lower case,  as well as another integer member for the total number of letters counted. The parameter int numStringsgives the length of the array of string pointers in char** stringList.

Requirements

You will be creating a project with 3 files that MUST be exactly named (capitalization and all):

  1. LetterCounter.cpp

  2. LetterCounter.h

  3. TestDriver.cpp (this file will be given to you)


You will be writing 1 function that MUST be exactly named (capitalization and all):

  1. LetterCounter countLetters(int numStrings, char** stringList)

Each File Serves the following purpose:

LetterCounter.h

LetterCounter.h will contain your class declaration as well as your function declaration.

LetterCounter.cpp

LetterCounter.cpp will contain your LetterCounter countLetters(int numStrings, char** stringList) definition. You do not need to write separate definition for your class (the declaration is enough). You function should operate as described below. Remember that classes are way for us to define our own data types so the return type of this function is LetterCounter.

The function you write serves a purpose

LetterCounter countLetters(int numStrings, char** stringList);


The parameters to the function will have the following memory model:


With these inputs you will iterator over each string in char** stringList and then iterate over each character in that string, incrementing the count for each individual normalized alphabetic character. Non-alphabetic characters should be ignored.  To normalize characters you may use your function from PSA[2> or you may use the “char tolower(char input)” function provided by the C++ language. Remember the number of strings you are iterating over is given as by the int numStrings parameter.


The return type is a class you will declare in your header file. It contains two members:

  1. int totalLettersCounted

    • This is the total number of letter counted across all strings in the list

  2. int letterCounts[26]

    • This is an array containing the counts for each individual letter.

    • ‘a’ is in index 0, ‘b’ is in index 1, ‘c’ is index 2 etc.


It’s memory model will look like this with 5 letters counted total: 2 a’s, 1 y and 2 z’s):

Is int numString positive? Is the parameter char** stringList NULL? Make sure to check these things before trying to use them!

ALSO MAKE SURE YOU TEST YOUR INPUTS TO MAKE SURE THEY MAKE SENSE!

Is int numString positive? Is the parameter char** stringList NULL? Make sure to check these things before trying to use them!


For this assignment I will also be providing your with a test driver TestDriver.cpp. This file will contain the main() function and will use your code to get the letter frequencies of a given list of strings. It will then print this output to the screen. Note that this is just a sample input and when we are actually grading this assignment we will be using other inputs as well.  


TestDriver.cpp can be located here: TestDrive.cpp

https://drive.google.com/file/d/0ByzTlffqfUOBZkFobGFmWU1RUHM/view?pli=1


Tutor Answer

(Top Tutor) Daniel C.
(997)
School: UC Berkeley
PREMIUM TUTOR

Studypool has helped 1,244,100 students

8 Reviews


Summary
Quality
Communication
On Time
Value
Five Star Tutor
Dec 4th, 2016
" Outstanding Job!!!! "
kpcutie
Nov 20th, 2016
" Excellent job "
Joemoe
Nov 11th, 2016
" <3 it, thanks for saving me time. "
Hemapathy
Nov 7th, 2016
" all I can say is wow very fast work, great work thanks "
pmallory
Oct 29th, 2016
" Totally impressed with results!! :-) "
kevin12622
Oct 15th, 2016
" Goes above and beyond expectations ! "
kiln82
Oct 6th, 2016
" awesome work thanks "
likeplum4
Sep 23rd, 2016
" Excellent work as usual "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1826 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors