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 17:30
How do you make a lenny face? plz, brailiest to who can answer first.
Answers: 1
question
Computers and Technology, 23.06.2019 04:31
This graph compares the cost of room and board at educational institutions in texas.
Answers: 1
question
Computers and Technology, 23.06.2019 14:00
Technician a says that with self-adjusting clutch systems, the release bearing constantly rotates. technician b says that the ball bearing portion of the release bearing should be lubricated with high-temperature grease during routine maintenance. which technician is correct?
Answers: 2
question
Computers and Technology, 23.06.2019 17:30
When making changes to optimize part of a processor, it is often the case that speeding up one type of instruction comes at the cost of slowing down something else. for example, if we put in a complicated fast floating-point unit, that takes space, and something might have to be moved farther away from the middle to accommodate it, adding an extra cycle in delay to reach that unit. the basic amdahl's law equation does not take into account this trade-off. a. if the new fast floating-point unit speeds up floating-point operations by, on average, 2ă—, and floating-point operations take 20% of the original program's execution time, what is the overall speedup (ignoring the penalty to any other instructions)? b. now assume that speeding up the floating-point unit slowed down data cache accesses, resulting in a 1.5ă— slowdown (or 2/3 speedup). data cache accesses consume 10% of the execution time. what is the overall speedup now? c. after implementing the new floating-point operations, what percentage of execution time is spent on floating-point operations? what percentage is spent on data cache accesses?
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, 07.03.2020 06:33