Generate the driver file (main.cpp) where you perform the following tasks. Note that you cannot make any change to the header file or the source file. Operation to Be Tested and Description of Action Create a queue of integers of size 5 Print if the queue is empty or not Enqueue four items Print if the queue is empty or not Print if the queue is full or not Enqueue another item Print the values in the queue (in the order the values are given as input) ● ● ● ● ● ● ● ● ● ● ● ● ● • Print if the queue is full or not Enqueue another item Dequeue two items Print the values in the queue (in the order the values are given as input) Dequeue three items Print if the queue is empty or not Dequeue an item Tele Input Values 10 5742 6 8 Expected Output Queue is Empty Queue is not Empty Queue is not full 57426 Queue is Full Queue Overflow 426 Queue is Empty Queue Underflow

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
20
Generate the driver file (main.cpp) where you perform the following tasks. Note that you cannot make any change to
the header file or the source file.
Operation to Be Tested and Description of Action
Create a queue of integers of size 5
Print if the queue is empty or not
Enqueue four items
Print if the queue is empty or not
Print if the queue is full or not
Enqueue another item
Print the values in the queue (in the order the values are given as
input)
●
●
●
●
●
●
●
●
●
●
●
.
•
Print if the queue is full or not
Enqueue another item
Dequeue two items
Print the values in the queue (in the order the values are given as
input)
Dequeue three items
Print if the queue is empty or not
Dequeue an item
Talu
Input Values
10
5742
6
8
Expected Output
Queue is Empty
Queue is not Empty
Queue is not full
57426
Queue is Full
Queue Overflow
426
Queue is Empty
Queue Underflow
Transcribed Image Text:20 Generate the driver file (main.cpp) where you perform the following tasks. Note that you cannot make any change to the header file or the source file. Operation to Be Tested and Description of Action Create a queue of integers of size 5 Print if the queue is empty or not Enqueue four items Print if the queue is empty or not Print if the queue is full or not Enqueue another item Print the values in the queue (in the order the values are given as input) ● ● ● ● ● ● ● ● ● ● ● . • Print if the queue is full or not Enqueue another item Dequeue two items Print the values in the queue (in the order the values are given as input) Dequeue three items Print if the queue is empty or not Dequeue an item Talu Input Values 10 5742 6 8 Expected Output Queue is Empty Queue is not Empty Queue is not full 57426 Queue is Full Queue Overflow 426 Queue is Empty Queue Underflow
In today's lab we will design and implement the Queue ADT using array.
quetype.h
#ifndef QUETYPE_H_INCLUDED
#define QUETYPE_H_INCLUDED
class FullQueue
{};
class EmptyQueue
{};
template <class ItemType>
class QueType
(
}
{
public:
Que Type ();
Que Type (int max);
~QueType();
void MakeEmpty();
bool IsEmpty();
(
bool IsFull();
void Enqueue (ItemType);
void Dequeue (ItemType);
#endif // QUETYPE_H_INCLUDED
private:
quetype.cpp
#include "quetype.h"
template <class ItemType>
QueType<ItemType>::Que Type (int max)
int front;
int rear;
ItemType items;
int maxQue;
maxQue = max + 1;
front = maxQue - 1;
rear = maxQue - 1;
items = new ItemType [maxQue];
.
template<class ItemType>
QueTypes ItemType>::Que Type()
maxQue = 501;
front = maxQue - 1;
rear=maxQue - 1;
items = new ItemType [maxQue];
template<class ItemType>
QueType<ItemType>::~QueType()
{
delete [] items;
}
template <class ItemType>
void
{
QueType<ItemType>::MakeEmpty()
}
template <class ItemType>
bool QueType<ItemType>::IsEmpty()
{
return (rear == front);
}
front = maxQue - 1;
rear=maxQue - 1;
4
template<class ItemType>
9
bool QueType<ItemType>:: IsFull()
{
1
return ((rear+1) maxQue == front);
template <class ItemType>
void QueType<ItemType>:: Enqueue (ItemType newItem)
{
if (IsFull())
else
1
throw FullQueue ();
1
template <class ItemType>
void QueType<ItemType>:: Dequeue (ItemType & item)
{
rear = (rear +1) maxQue;
items [rear] = newItem;
else
{
if (IsEmpty())
throw EmptyQueue ();
front = (front + 1) + maxQue;
item=items [front);
99+
Transcribed Image Text:In today's lab we will design and implement the Queue ADT using array. quetype.h #ifndef QUETYPE_H_INCLUDED #define QUETYPE_H_INCLUDED class FullQueue {}; class EmptyQueue {}; template <class ItemType> class QueType ( } { public: Que Type (); Que Type (int max); ~QueType(); void MakeEmpty(); bool IsEmpty(); ( bool IsFull(); void Enqueue (ItemType); void Dequeue (ItemType); #endif // QUETYPE_H_INCLUDED private: quetype.cpp #include "quetype.h" template <class ItemType> QueType<ItemType>::Que Type (int max) int front; int rear; ItemType items; int maxQue; maxQue = max + 1; front = maxQue - 1; rear = maxQue - 1; items = new ItemType [maxQue]; . template<class ItemType> QueTypes ItemType>::Que Type() maxQue = 501; front = maxQue - 1; rear=maxQue - 1; items = new ItemType [maxQue]; template<class ItemType> QueType<ItemType>::~QueType() { delete [] items; } template <class ItemType> void { QueType<ItemType>::MakeEmpty() } template <class ItemType> bool QueType<ItemType>::IsEmpty() { return (rear == front); } front = maxQue - 1; rear=maxQue - 1; 4 template<class ItemType> 9 bool QueType<ItemType>:: IsFull() { 1 return ((rear+1) maxQue == front); template <class ItemType> void QueType<ItemType>:: Enqueue (ItemType newItem) { if (IsFull()) else 1 throw FullQueue (); 1 template <class ItemType> void QueType<ItemType>:: Dequeue (ItemType & item) { rear = (rear +1) maxQue; items [rear] = newItem; else { if (IsEmpty()) throw EmptyQueue (); front = (front + 1) + maxQue; item=items [front); 99+
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY