you will be implementing a class which acts as a dynamically-sized integer array. When the object...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
you will be implementing a class which acts as a dynamically-sized integer array. When the object is instantiated, it will allocate a dynamic array of integers with the given capacity. 1. Declare and define the default constructor. The default capacity should be set to 1. Therefore, you should allocate a dynamic array of size 1. 2. Declare and define the parameterized constructor. Accept the default capacity as an int and allocate a dynamic array with this size. 3. Create a function named pushValue, which returns an unsigned int and accepts one int. This function should: 1. Add the passed-in int into the next available spot in the array. Assume that a spot will always be available (capacity will always be greater than the number of times push is called). 2. Return the index where the integer was added, starting with O, like a standard C++ array. 4. Create a function named getArray, which returns an int* pointing to the first element of your array, 5. Implement the copy assignment operator. Remember to perform a deep copy. 6. Implement the destructor, which deallocates all memory used by your class. you will be implementing a class which acts as a dynamically-sized integer array. When the object is instantiated, it will allocate a dynamic array of integers with the given capacity. 1. Declare and define the default constructor. The default capacity should be set to 1. Therefore, you should allocate a dynamic array of size 1. 2. Declare and define the parameterized constructor. Accept the default capacity as an int and allocate a dynamic array with this size. 3. Create a function named pushValue, which returns an unsigned int and accepts one int. This function should: 1. Add the passed-in int into the next available spot in the array. Assume that a spot will always be available (capacity will always be greater than the number of times push is called). 2. Return the index where the integer was added, starting with O, like a standard C++ array. 4. Create a function named getArray, which returns an int* pointing to the first element of your array, 5. Implement the copy assignment operator. Remember to perform a deep copy. 6. Implement the destructor, which deallocates all memory used by your class.
Expert Answer:
Answer rating: 100% (QA)
include using namespace std class DynamicIntArray private data members int array int capacity int si... View the full answer
Related Book For
Data Structures and Algorithms in Python
ISBN: 978-1118290279
1st edition
Authors: Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser
Posted Date:
Students also viewed these programming questions
-
What are the advantages and disadvantages of autocratic leadership? Cite an example from your own experience that describes autocratic leadership. Your response should be at least 200 words in length...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
1. Consider the linear system Ax = b (all integer values) with the notation shown below, 1 -3 -1 -2 - H 5 7 - 2261x11 X2 -4 3 9 16x3 615 LX4- = A X b The element a24 = a has been lost. Assume,...
-
Use the computer software to sketch the variation of pressure with temperature in Problem 3.41. Extend the curve a little into the single-phase region
-
Edith's warehouse (adjusted basis of $450,000) is destroyed by a hurricane in October 2013. Edith, a calendar year taxpayer, receives insurance proceeds of $525,000 in January 2014. Calculate Edith's...
-
A one ton refrigeration system means that its refrigerating effect is (a) 50 kJ/min (b) 210 kJ/min (c) 300 kJ/min (d) 350 kJ/min
-
The balance sheet of Watson Company as of December 31, 20X1, follows. The following information has been extracted from the firm's accounting records: All sales are made on account at $20 per unit....
-
On the first day of the current fiscal year, $2,000,000 of 10-year, 7% bonds, with interest payable semiannually, were sold for $2,125,000. Journalize the following transactions for the current...
-
When considering a private cloud for a large clinic or hospital, identify two key issues that you believe should be examined by the auditor for each of the following risks: (1) regulatory risk, (2)...
-
Describe a learning situation in which you or another person had difficulty in achieving a desired performance. Develop a plan to improve performance using the techniques. What are some possible...
-
What is financial management? What are the types of financial management. Explain each type with example.
-
Motors has a total debt of of 682,400 and a debt equity ratio of 6.5% what is the value of the total assets? How it can be determined give all step by step solution for this question.
-
Nova Incorporated declared and paid $4,800 of cash dividends during the current year ended December 31. Its financial statements also reported the following summarized data: Current Previous Income...
-
What is the output of the ?following code #include using namespace std; int xyz (int x, int y) { int result; result = 0; { while (y != 0) result = result + x;B y = y 1; } return(result); } int main...
-
Study Guide PSY230 Study Guide Exam 2 (Modules 5 - 9) Chapter 5: Early Childhood Motor skills: What is the difference between gross and fine motor skills? What are some examples of each? What is the...
-
You have been approached by Marumo a cattle farmer in the Kweneng District of Botswana. He has provided you with the following details from his farming business asking you to prepare his tax returns...
-
(a) As Section 17.3 discusses, high-frequency sound waves exhibit less diffraction than low-frequency sound waves do. However, even high-frequency sound waves exhibit much more diffraction under...
-
What parameters should be sent to the range constructor, to produce a range with values 50, 60, 70, 80?
-
Give a big-Oh characterization, in terms of n, of the running time of the example 2 function shown in Code Fragment 3.10. 1 def example1(S): "Return the sum of the elements in sequence S.""" n =...
-
In order to verify that all of its nontree edges are back edges, redraw the graph from Figure 14.8b so that the DFS tree edges are drawn with solid lines and oriented downward, as in a standard...
-
In a vapour compression refrigeration system, the condition of refrigerant before entering the compressor is (a) saturated liquid (b) wet vapour (c) dry saturated liquid (d) superheated vapour
-
During a refrigeration cycle, heat is rejected by the refrigerant in (a) compressor (b) condenser (c) evaporator (d) expansion valve
-
The highest temperature during the cycle in vapour compression refrigeration system occurs after (a) compression (b) condensation (c) expansion (d) evaporation
Study smarter with the SolutionInn App