subject
Computers and Technology, 21.01.2021 23:00 RDS468

One problem with dynamic arrays is that once the array is created using the new operator 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 project asks you to create a class called DynamicStringArray that includes member functions that allow it to emulate the behavior of a vector of strings. The class should have:
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.
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 deleteEntry 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 "" string if the index is out of dynamicArray’s bounds.
Overload the operator[] so that you can get and change an element by an index integer. If the index is out-of-bounds, return a "" string.
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.
A destructor that frees up the memory allocated to the dynamic array.
Create a suitable test program to test your class.
You should name the project ASG10. When you zip up the project folder, ASG10, include all the files (.sln, .cpp, etc) and subdirectories (Debug, etc.).

Copy your DynamicStringArray from Assignment 10. Fix the program so all 13 tests work properly. Modify the definition of the overloaded operator [] and getEntry so they throw an OutOfRange exception if an index that is out of range is used. OutOfRange is an exception class that you define. The exception class should have a private int member and a private string member, and a public constructor that has int and string arguments. The offending index value along with a message should be stored in the exception object. You choose the message to describe the situation. Modify your test program and add tests that catch the new exception class.
You should name the project ASG14. When you zip up the project folder, ASG14, include all the files (.sln, .cpp, etc) and subdirectories (Debug, etc.).

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:00
Duplicating objects creates copies that a. move differently than the original object b. erase the original object c. look and act like the original object d. add events to a game
Answers: 1
question
Computers and Technology, 23.06.2019 05:00
Acompany is inviting design for its new corporate logo from its users. this is an example of ? a. crowdfunding b. crowdvoting c. crowdsourced design d. crowdtracking
Answers: 3
question
Computers and Technology, 23.06.2019 18:30
This program should be a short piece of code that prints all of the positive integers from 1 to 100 as described more fully below. the program may contain multiple methods, and if using an oo language, should be contained within a single class or object. the program should be designed so that it begins execution when invoked through whichever mechanism is most common for the implementation language. â–ş print out all positive integers from 1 to 100, inclusive and in order. â–ş print messages to standard output, matching the sample output below. â–ş in the output, state whether the each integer is 'odd' or 'even' in the output. â–ş if the number is divisible by three, instead of stating that the number is odd or even, state that the number is 'divisible by three'. â–ş if the number is divisible by both two and three, instead of saying that the number is odd, even or divisible by three; state that the number is 'divisible by two and three'. â–ş design the logic of the loop to be as efficient as possible, using the minimal number of operations to perform the required logic. sample output the number '1' is odd. the number '2' is even. the number '3' is divisible by three. the number '6' is divisible by two and three.
Answers: 1
question
Computers and Technology, 23.06.2019 21:00
Will this setup result in what kathy wants to print?
Answers: 2
You know the right answer?
One problem with dynamic arrays is that once the array is created using the new operator the size ca...
Questions
question
Mathematics, 27.09.2021 14:00
question
Mathematics, 27.09.2021 14:00
question
Physics, 27.09.2021 14:00
question
Mathematics, 27.09.2021 14:00
question
Chemistry, 27.09.2021 14:00
Questions on the website: 13722366