[Solved] EECE 1080 Lab7- Array, Vectors and String Stats

$25

File Name: EECE_1080_Lab7-_Array,_Vectors_and_String_Stats.zip
File Size: 442.74 KB

SKU: [Solved] EECE 1080 Lab7- Array, Vectors and String Stats Category: Tag:
5/5 - (1 vote)

The objective of this lab is to gain experience creating and using 1-dimensional arrays, practice using functions, and creating functions that use strings. Also, it will reinforce the concepts of loop structures, functions, and text formatting.

This goal of this assignment is to create a set of functions to analyze a 1-dimensional integer and string arrays. You will test these functions on various arrays you create in your main() program. Your main() function will call the various functions to produce various statistics on this array. Laboratory Checklist:

  • Review loops
  • Review C/C++ functions
  • Review Single Dimensional C++ arrays
  • Review C++ Strings
  • Review vectors
  • Read Problem Specification
  • Create and Test the functions listed in the specification.
  • Have TA/Instructor perform a code review
  • Once your code is tested please submit it to zyBooks for final grade assignment. Look for the Laboratory 5 assignment pages. You will need to cut-and-paste your source code into the zybook environment.

You will only have 10 submissions for this laboratory so please make sure you test your code thoroughly submission.

Specification:

Using the starting file for this assignment create the functions listed in the function development section (Task 3).

Task 1: Review material used in assignment

Review functions, arrays, strings, and read the problem specification before continuing.

Task 2: Download the starter file from blackboard: array-string-stats.cpp. The main() in this file has test conditions setup for some of the functions you will be developing.

Please create a project in your IDE and add array-string-stats.cpp. Task 3: Function Development

The student is required to create the following functions in source file called array-string-stats.cpp.

Please avoid using magic number s in these functions. Use constants when appropriate.

The student needs to create the following functions with the names indicated. Array Functions:

Below are descriptions of the 11 functions you are to write:

Integer Functions:

  1. find Accepts an integer array, its length, and a integer value to find. It returns true if value exists in the array.

Otherwise it returns false if not found.

  1. isSorted Accepts an integer array and length. It determines if it is sorted in ascending numeric order. Returns true, if it is sorted or false if it is not.
  2. mean Accepts a float vector. This function returns the mean of the elements of the vector. Return 0 if the vector is empty.
  3. stddev Given a float array vector return the populatio n standard deviation as a double (divide by N not N-1). Return 0.0 if the vector is empty. You may want use mean() function above.
  4. removeDups Accepts an int vector and returns a new vector. This function should return a new vector with all duplicate elements removed.
  5. reverse Accepts an integer vector. This function flips the order, so the first element becomes the last and the last, the first, etc. Returns nothing , but the provided vector will be changed. Should work for ANY sized vector.

String Functions:

  1. countUpperCaseChars Given a string, return the number of uppercase characters. Use isupper from the cctype library.
  2. convertToUpper Given an input string convert all alphabetic characters to uppercase. Return a new string converted to uppercase. If the input string is empty just return the input string.
  3. removeSpaces Given an input string remove all spaces from this string. Return a new string with spaces removed. If the input string is empty return the original string.
  4. numWords Given a string, return the number of words it contains. A word is defined to be a sequence of alphabetic (isalpha) characters with non-alphabetic characters on each side. If alphabetic characters start or end the string, they are considered a word. The best method to solve this is to use the isalpha function to determine the beginning and end of each string.
  5. characterCounts Given a string, return a vector of ints of length 26 containing the number of times each letter was seen. Index 0 corresponds to a, 1 to b, etc Treat upper-case letters as lower-case.

See the end of this document for an example running of the program.

Task 4: Code Review

To receive any credit for this assignment, have the TA/instructor review your functions and style. You can do this anytime after you have completed at least four functions.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] EECE 1080 Lab7- Array, Vectors and String Stats
$25