In today's lab we will design and implement the Queue ADT using array. quetype.h #ifndef QUETYPE_H_INCLUDED #define QUETYPE_H_INCLUDED const int max_items = 50; class FullQueue { }; class EmptyQueue{ }; template class QueType { public: QueType(); void MakeEmpty(); bool isEmpty(); bool isFull(); void Enqueue(T); void Dequeue(); T Front(); private: int front; int rear; Tinfo[max_items]; }; #endif // QUETYPE_H_INCLUDED

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

Solve this problem!

In today's lab we will design and implement the Queue ADT using array.
quetype.h
#ifndef QUETYPE_H_INCLUDED
#define QUETYPE_H_INCLUDED
const int max_items = 50;
class FullQueue {
};
class EmptyQueue {
};
template<class T>
class QueType
{
public:
QueType();
void MakeEmpty();
bool isEmpty();
bool isFull();
void Enqueue(T);
void Dequeue();
T Front();
private:
int front;
int rear;
Tinfo(max_items];
};
#endif // QUETYPE_H_INCLUDED
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 const int max_items = 50; class FullQueue { }; class EmptyQueue { }; template<class T> class QueType { public: QueType(); void MakeEmpty(); bool isEmpty(); bool isFull(); void Enqueue(T); void Dequeue(); T Front(); private: int front; int rear; Tinfo(max_items]; }; #endif // QUETYPE_H_INCLUDED
Operation to Be Tested and Description of Action
Create a queue of integers of size 5
Print if the queue is empty or not
Call the Front function
Enqueue four items
Print if the queue is empty or not
Check if the queue is full
Enqueue another item
Print the values in the queue
Print if the queue is full or not
Enqueue another item
Dequeue two items
Print the values in the queue
Dequeue three items
Print if the queue is empty or not
Input Values Expected Output
Queue is Empty
No data to return
5742
Queue is not Empty
Queue is not Full
6.
57426
Queue is Full
Queue is already Full
426
Queue is Empty
Queue is already Empty
Dequeue an item
Enqueue five items
Create a new function so that you can print the Queue in
reverse order.
123 45
5 432 1
void PrintReverse(QueType<int> q);
However, The actual Queue has to remain identical.
Print the values in the queue
Take an integer n from the user as input and use a queue
to print Binary vahues of each integer from 1 to n. Here is
how it can be done.
o Create an empty queue
o Enqueue the first binary number "1" to the queue.
o Now run a loop for generating and printing n binary
numbers.
• Dequeue and print the value.
• Append "0" at the dequeued value and enqueue it.
• Append "1" at the dequeued value and enqueue it.
123 45
10
1
10
11
100
101
110
111
1000
1001
1010
void PrintBinary(int n);
*(You might have to change the max_items of the
Queue for this function).
Transcribed Image Text:Operation to Be Tested and Description of Action Create a queue of integers of size 5 Print if the queue is empty or not Call the Front function Enqueue four items Print if the queue is empty or not Check if the queue is full Enqueue another item Print the values in the queue Print if the queue is full or not Enqueue another item Dequeue two items Print the values in the queue Dequeue three items Print if the queue is empty or not Input Values Expected Output Queue is Empty No data to return 5742 Queue is not Empty Queue is not Full 6. 57426 Queue is Full Queue is already Full 426 Queue is Empty Queue is already Empty Dequeue an item Enqueue five items Create a new function so that you can print the Queue in reverse order. 123 45 5 432 1 void PrintReverse(QueType<int> q); However, The actual Queue has to remain identical. Print the values in the queue Take an integer n from the user as input and use a queue to print Binary vahues of each integer from 1 to n. Here is how it can be done. o Create an empty queue o Enqueue the first binary number "1" to the queue. o Now run a loop for generating and printing n binary numbers. • Dequeue and print the value. • Append "0" at the dequeued value and enqueue it. • Append "1" at the dequeued value and enqueue it. 123 45 10 1 10 11 100 101 110 111 1000 1001 1010 void PrintBinary(int n); *(You might have to change the max_items of the Queue for this function).
Expert Solution
steps

Step by step

Solved in 3 steps with 5 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