subject

The Queue1 class is a naive implementation of a queue using the provided functionality of the MyVector. The Queue2 class will alter the MyVector behavior by introducing a circular array pattern to the array stored. And, the Queue3 class is a naive implementation of a queue using the default behavior of the List class. Provided Files:
proj10-ContainerIfc. h
proj10-Node. h
proj10-ContainerIfc. h
class BADINDEX {};
template
class ContainerIfc {
public:
virtual ContainerIfc & pushFront(T) =0;
virtual ContainerIfc & pushBack(T) =0;
virtual ContainerIfc & popFront(T&) =0; // throws BADINDEX
virtual ContainerIfc & popBack(T&) =0; // throws BADINDEX
virtual int getSize() =0;
virtual bool isEmpty() =0;
virtual T front() =0; // throws BADINDEX
virtual T back() =0; // throws BADINDEX
virtual T& operator [](int) =0; // throws BADINDEX
virtual void erase() =0;
};
proj10-Node. h - notice that this Node. h is different from the previous MyList implementation
template
class Node {
public:
T data;
Node *next;
Node( T d ) {
data = d;
next = NULL;
}
~Node( ) {
delete next;
}
};
Deliverables:
proj10-driver. cpp
proj10-MyVector. h
proj10-MyList. h
proj10-Queue1.h
proj10-Queue2.h
proj10-Queue3.h
proj10-driver. cpp
Your driver should randomly generate and enqueue 100 integer values in each queue implementation. It should then time (using the time() fucnction) the dequeue of all integer values stored for each implementation of the queue independently. I encourage each of you to experiment locally with much larger numbers of integers to demonstrate the performance (efficiency) differences between these different queue implementations. Unfortunately, the upload site limits runtime for your programs to 1 second, and you won't be able to distiguish a difference between the runtimes of the different implementations in less than a second. So, our turned in version of the driver needs to be limited to 100 integers to ensure it completes all three implementations within that second of runtime.
proj10-MyVector. h
#include "proj10-ContainerIfc. h"
template
class MyVector : public ContainerIfc {
public:
MyVector ();
~MyVector ();
MyVector (const MyVector&);
MyVector& operator = (const MyVector&);
MyVector& pushFront(T);
MyVector& pushBack(T);
MyVector& popFront(T&); // throws BADINDEX
MyVector& popBack(T&); // throws BADINDEX
T front(); // throws BADINDEX
T back(); // throws BADINDEX
T& operator [](int); // throws BADINDEX
int getSize();
bool isEmpty();
void erase();
protected:
T *data;
int size;
int capacity;
void grow();
void shiftRight();
void shiftLeft();
};
proj10-MyList. h - notice that we are updating the original MyList implementation by adding a tail
#include "proj10-ContainerIfc. h"
#include "proj10-Node. h"
template
class MyList : public ContainerIfc {
public:
MyList();
~ MyList();
MyList(const MyList &);
MyList & operator = (const MyList &);
MyList & pushFront(T);
MyList & pushBack(T);
MyList & popFront(T&); // throws BADINDEX
MyList & popBack(T&); // throws BADINDEX
int getSize();
bool isEmpty();
T front(); // throws BADINDEX
T back(); // throws BADINDEX
T& operator [](int); // throws BADINDEX
private:
Node *head;
Node *tail;
};
proj10-Queue1.h - naive implementation of queue using your MyVector implementation
#include "proj10-MyVector. h"
template
class Queue1 : public MyVector {
public:
void enqueue( T );
void dequeue( T& ); // throws BADINDEX
};
proj10-Queue2.h - still uses the MyVector, but implemented using "circular" array
#include "proj10-MyVector. h"
template
class Queue2 : public MyVector {
private:
int front, rear;
public:
Queue2();
void enqueue( T );
void dequeue( T& ); // throws BADINDEX
};
proj10-Queue3.h - implementation using your MyList implementation
#include "proj10-MyList. h"
template
class Queue3 : public MyList {
public:
void enqueue( T );
void dequeue( T& ); // throws BADINDEX
};
Expert A

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:30
On the loan worksheet in cell c9 enter pmt function to calculate the monthly payment for the altamonte springs 2018 facilities loan. ensure that the function returns a positive value and set the reference to cells b5 and b6 as absolute references.
Answers: 2
question
Computers and Technology, 22.06.2019 13:00
Write a program which asks you to enter a name in the form of first middle initial last. so you might enter for example samuel p. clemens. use getline to read in the string because it contains spaces. also, apparently the shift key on your keyboard doesn’t work, because you enter it all lower case. pass the string to a function which uses .find to locate the letters which need to be upper case and use toupper to convert those characters to uppercase. the revised string should then be returned to main in the form last, first mi where it will be displayed.
Answers: 1
question
Computers and Technology, 22.06.2019 21:40
Develop a function to create a document in the mongodb database “city” in the collection “inspections.” be sure it can handle error conditions gracefully. a. input -> argument to function will be set of key/value pairs in the data type acceptable to the mongodb driver insert api call b. return -> true if successful insert else false (require a screenshot)
Answers: 2
question
Computers and Technology, 22.06.2019 22:40
In this lab, you complete a python program that calculates an employee's annual bonus. input is an employee's first name, last name, salary, and numeric performance rating. if the rating is 1, 2, or 3, the bonus rate used is .25, .15, or .1 respectively. if the rating is 4 or higher, the rate is 0. the employee bonus is calculated by multiplying the bonus rate by the annual salary.
Answers: 1
You know the right answer?
The Queue1 class is a naive implementation of a queue using the provided functionality of the MyVect...
Questions
Questions on the website: 13722360