Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

CPSC Program

This is the program

Write a class to represent a dynamically sized array of integers. Name it DynArray.

submit: a file named dynarray.h that contains all of your class code

Class specifications:

Private data members:

data arraysize datasize

- a pointer to integer array data

- an integer representing the array size (allocated space) - an integer representing the amount of data stored in the array Public member functions:

default constructor: Sets the array size to be 10 elements, the data size to be 0, and dynamically allocates the 10 element array space.

constructor receiving size: Checks the size parameter value to make sure that it is a positive (>0) value. If the value is positive, it
becomes the array size.

If the value is not legal, the array size should be set to 10. After setting the array size, the data size is set to 0, and the dynamic allocation is performed.

copy constructor: Receive one DynArray object as a parameter and make the new object a copy of that object with its own separately allocated memory space, but with the same sizes and same data.

destructor: Dynamically de-allocate the array space and set the pointer value to NULL.

setArraySize: This function receives a size value. If the parameter value is

greater than the existing array size, change the array size, allocate a new array space, copy all of the data values to the new space, and deallocate the old array space.

If the size value is invalid (smaller than current size), do nothing.

getArraySize: Return a copy of the array size field.

getDataSize: Return a copy of the data size field.

addValue: Receives an integer value. If there is currently room in the

allocated array space, then store the value into the array. If there is not space, then relocate the array to another location with twice as much space as before, and then store the parameter value into the array.

= operator: Receives one DynArray object as a parameter and makes the current object a copy of that parameter object with its own separately allocated array space. Make sure to de-allocate the current array space before dynamically allocating a new one.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92074945
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Recall that the op-code and operand are represented in

Recall that the op-code and operand are represented in memory by HEX numbers (e.g., LDAA $3000 will show in memory as $B6, $30, and $00). Write a short program to use the commands LDAA and STAA to load and store a value ...

What type of economic system does norway have explain some

What type of economic system does Norway have? Explain some of the benefits of this system to the country and some of the drawbacks,

For recursion trees why sometime there are 2 recursion

For recursion trees, why sometime there are 2 recursion trees shown. why sometimes the work per level decreases from level to level, and it is constant in each level. The recursion tree shown for merge sort has same tota ...

Explain the difference between penetration tests and

Explain the difference between penetration tests and security tests. Emphasize that this book will explain things from a security testing perspective.

Computer sciencewhat is required of an organization to

Computer Science What is required of an organization, to implement and maintain IT Governance? What outside resources are available to assist technology managers in the implementation and maintenance process?

This subject is computer architecture organizationdraw a

This subject is computer Architecture organization Draw a flowchart showing the steps for a CPU program that uses programmed I/O to send a string consisting of 10 characters to a printer connected through a UART interfac ...

Question do a research on the internet and discuss about

Question : Do a research on the Internet and discuss about the history of development of the networking field. Also discuss some of the recent trends in the networking area, (approx 200 words)

Suppose that on your birthday you checked the balance on

Suppose that on your birthday you checked the balance on your retirement account and you decided to make a $1,000 payment at the end of every month until you retire at the specified age. If you disreagard the inflation ( ...

Requirementsthis week you will write single page web

Requirements This week you will write single page web application that will receive incoming POST and GET requests. If it is a POST request it should say at the top of the page, in an H1 tag "POST Request Received". If a ...

A streaming company needs to measure the average time

A streaming company needs to measure the AVERAGE time spread for users who watch video on their platform in a session. Each user has one time spread, which is the difference between her longest session streaming video an ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As