Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class called dynamicStringArray which includes member functions that allow it to emulate the behavior of a vector of strings. Your solution should be

image text in transcribed

Create a class called dynamicStringArray which includes member functions that allow it to emulate the behavior of a vector of strings. Your solution should be done in 3 seperate files. DSArary.h, DSArray.cpp, Main.cpp.

COMP 252 Homework 1-Object-Oriented Design Review One problem with arrays is that once the array is created the size cannot be changed. For example, you might want to add or delete entries from the array similar to the behavior of a vector. This assignment asks you to create a class called DynamicStringArray which includes member functions that allow it to emulate the behavior of a vector of strings. The class should have the following: A private member variable called dynamicArray that references a dynamic array of type string. . .A private member variable called size that holds the number of entries in the array . A default constructor that sets the dynamic array to NULL and sets size to 0 .A function that returns size of the string array . A function named addEntry that takes a string as input. The function should create a new dynamic array one element larger than dynamicArray, copy all elements from dynamicArray into the new array, add the new string onto the end of the new array, increment size, delete the old dynamicArray, and then set dynamicArray to the new array A function named de leteEntry that takes a string as input. The function should search dynamicArray for the string. If not found, return false. If found, create a new dynamic array one element smaller than dynamicArray. Copy all elements except the input string into the new array, delete dynamicArray, decrement size, and return true A function named getEntry that takes an integer as input and returns the string at that index in dynamicArray. Return NULL if the index is out of dynamicArray's bounds. A copy constructor that makes a copy of the input object's dynamic array Overload the assignment operator so that the dynamic array is properly copied to the target object. Overload the array subscript operator [] to support quickly changing or accessing strings in the array. Overload the ostream operator

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

KEY QUESTION Refer to Figure 3.6, page

Answered: 1 week ago