Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include using namespace std; class stackN; class NodeS{ private: NodeS(int, Nod

ID: 3576936 • Letter: #

Question

#include

using namespace std;

class stackN;

class NodeS{
   private:
       NodeS(int, NodeS*);
       int data;
       NodeS* next;
       friend class stackN;
friend ostream& operator<<(ostream&, const stackN&);
};

class stackN{
public:
stackN();
stackN(const stackN&);
~stackN();
stackN& operator=(const stackN&);
bool push(int);
bool pop();
int getTop();
bool empty() const;
bool full() const;
bool clear();
               bool operator==(const stackN&) const;
friend ostream& operator<<(ostream&, const stackN&);
private:
               NodeS* top;
};

queueA.h

#include

using namespace std;

class queueA{
public:
queueA(int = 10);
queueA(const queueA&);
~queueA();
queueA& operator=(const queueA&);
bool enqueue(int);
bool dequeue();
int getFront();
bool empty() const;
bool full() const;
bool clear();
bool operator==(const queueA&) const;
friend ostream& operator<<(ostream&, const queueA&);
private:
int max;
int front;
int rear;
int *data;
};

queueN.h

#include

using namespace std;

class queueN;

class NodeQ{
   private:
       NodeQ(int, NodeQ*);
       int data;
       NodeQ* next;
       friend class queueN;
       friend ostream& operator<<(ostream&, const queueN&);
};

class queueN{
       public:
               queueN();
               queueN(const queueN&);
               ~queueN();
               queueN& operator=(const queueN&);
               bool enqueue(int);
               bool dequeue();
               int getFront();
               bool empty() const;
               bool full() const;
               bool clear();
               bool operator==(const queueN&) const;
               friend ostream& operator<<(ostream&, const queueN&);
       private:
               NodeQ* front;
               NodeQ* rear;
};


I just need the .cpp implementation files of these header files.

Description: For this project, you will write two stack classes and two queue classes with different implementations; namely array-based and node-based implementation for both abstract data types. Stacks are Last Inn First Out (LIFO) data structures. Stacks insert data from the top (push) and remove data from the top (pop). A stack's data member top "points" to the top of the stack. Queues are First In-First Out (FIFO) data structures. Unlike stacks which insert and remove data from top, queues insert data from rear (enqueue) and removedata from front (dequeue) Instead of a stack's data member top which "points" to the top of the stack, a queue has two data members: front which "points" to the first data value of the queue; and rear which "points" to the last data value of the queue. For this project, you are required to implement an array-based stack, a node-based stack, an array based queue and a node-based queue. All stack and queue classes will hold integers. All code must be accomplished using pointer manipulation and dynamic memory where applicable. In arraybased stack implementation, stack moves top up the array when pushing and down when popping. The array-based stack class includes the following data members: max an integer specifying the maximum size of the array (default size is 100 top an integer specifying the index of the top value in the stack data a pointer pointing to the array of values

Explanation / Answer

#include    <iostream>
#include    <iomanip>
#include    "StackA.h"
using namespace std;

class stackA
{
public:
         stackA(int=10);
         StackA(const stackA&):
         ~stackA();
         stackA& operator=(const stackA&);
         bool push(int);
         bool pop();
         int getTop();
         bool empty() const;
         bool free() const;
         bool clear();
               bool operator==(const stackA&) const;
        friend ostream& operator<<(ostream&,const stackA&);
private:
          int max;
          int top;
          int* data;
};

stackN.h
#include    <iostream>
#include    <iomanip>
#include    "StackN.h"
using namespace std;

class stackN;

class NodeS{
   private:
       NodeS(int, NodeS*);
       int data;
       NodeS* next;
       friend class stackN;
friend ostream& operator<<(ostream&, const stackN&);
};

class stackN{
public:
stackN();
stackN(const stackN&);
~stackN();
stackN& operator=(const stackN&);
bool push(int);
bool pop();
int getTop();
bool empty() const;
bool full() const;
bool clear();
               bool operator==(const stackN&) const;
friend ostream& operator<<(ostream&, const stackN&);
private:
               NodeS* top;
};

queueA.h
#include    <iostream>
#include    <iomanip>
#include "queueA.h"

using namespace std;

class queueA{
public:
queueA(int = 10);
queueA(const queueA&);
~queueA();
queueA& operator=(const queueA&);
bool enqueue(int);
bool dequeue();
int getFront();
bool empty() const;
bool full() const;
bool clear();
bool operator==(const queueA&) const;
friend ostream& operator<<(ostream&, const queueA&);
private:
int max;
int front;
int rear;
int *data;
};

queueN.h

#include    <iostream>
#include    <iomanip>
#include "queueN.h"


using namespace std;

class queueN;

class NodeQ{
   private:
       NodeQ(int, NodeQ*);
       int data;
       NodeQ* next;
       friend class queueN;
       friend ostream& operator<<(ostream&, const queueN&);
};

class queueN{
       public:
               queueN();
               queueN(const queueN&);
               ~queueN();
               queueN& operator=(const queueN&);
               bool enqueue(int);
               bool dequeue();
               int getFront();
               bool empty() const;
               bool full() const;
               bool clear();
               bool operator==(const queueN&) const;
               friend ostream& operator<<(ostream&, const queueN&);
       private:
               NodeQ* front;
               NodeQ* rear;
};