Question: THIS IS C++ ! I am supposed to implement the class Quack using the following. I also have included what I have so far but
THIS IS C++ ! I am supposed to implement the class Quack using the following. I also have included what I have so far but it doesn't work. I don't really know c++ very well, can you show me how you would implement it and use comments to explain where needed?

This is my implementation: 



You will write a class named Quack which is a single structure that can be used as a basis for implementing both stacks and queues. Our Quack structure will allow insertion and removal at one end, but only removal at the other. For convenience, we will refer to the removal-only end as the left end, and the other as the right. Your Quack should be implemented as follows: The underlying data structure will be a C++ standard vector. Following the convention of the queue we discussed in class, you will allow the data to "float" in the vector, with the following difference: If, upon a removal, you discover that the contiguous block of data (whose size is, say, k ) will "fit" in the first k empty positions of the vector, then you should resize down by making a new vector and copying the k pieces of data into that new vector using the push_back function. Additions to the structure can use the standard vector functions, and can only occur at the "right" side of the contiguous data (i.e. the position of largest index). (Note that in this implementation the structure is not "circular"-we do not wrap the data using the modulo of the array size.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
