
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Write the full C++ code for the provided output in the screenshot

Transcribed Image Text:Define the Queue class template in the file DoublyLinkedQueue.cpp.
// DoublyLinkedQueue.cpp
#ifndef QUEUE_H
#define QUEUE_H
#include <iostream>
using namespace std;
template<typename T>
class Queue
{
public:
// Default constructor
Queue()
front = new NodeType;
back new NodeType;
front->next = back;
back->prev = front;
//Desctructor
}
~Queue()
{
}
clear();
delete front;
delete back;
// Makes the queue to the empty state.
void clear()
{
}
// Checks if the queue is empty.
bool empty() const
{
}
// Inserts item at the end of the queue.
void enqueue(const T& item)
{
}
// Removes the element at the start of the queue.
void dequeue()
{
}
// returns the front element
const T& front_element () const
{
{
}
// Prints the elements of the queue.
void print() const
Node Type* ptr = front->next;
while (ptr = back)
{
cout << ptr->data << ",
ptr = ptr->next;
}
cout << endl;
}
private:
struct NodeType
{
T data;
Node Type* next;
NodeType✶ prev;
NodeType(const T & d = T()): data(d), prev(nullptr), next(nullptr)
{}
};
Node Type* front%3B // points to the header node
Node Type back; // points to the tail node
};
#endif

Transcribed Image Text:Please read the comments carefully and implement the Queue template class.
The main function is contained in the file lab07.cpp.
// lab07.cpp
#include "Employee.cpp"
#include "DoublyLinkedQueue.cpp"
int main()
{
Queue<int> intQue;
int x = 0, k = 0;
cout << "Enqueue positive numbers (enter 0 to stop): ";
cin >> x;
// add your code
return 0;
}
The main function contains 3 parts.
A. Part 1:
1. Declares a queue which stores int values.
2. Prompts users to enter integers, enqueues the entered values, stops entering the integers when users enter O.
3. Prints the elements of queue.
4. Prompts the user to enter a number K, and dequeues ✓ values from the front of the queue.
5. Prints the elements of queue.
B. Part 2:
1. Declares a queue which stores strings.
2. Prompts users to enter strings, enqueue the entered strings, stops entering the strings when the user enter "exit".
3. Prints the elements of queue.
4. Prompts users to enter a number K, and dequeues K strings from the front of the queue.
5. Prints the elements of queue.
C. Part 3:
1. Declares a queue which stores Employee objects. Download Employee class file Employee.cpp ✓ and store it in cse2020/lab07
2. Prompts users to enter employee's id, name, and department name, create an employee object, enqueue the created employee boject, stops entering the employees when the user enter id as O.
3. Prints the elements of queue.
4. Prompts users to enter a number K, and dequeues ✓ employees from the front of the queue.
5. Prints the elements of queue.
The expected result:
Enqueue positive numbers (enter 0 to stop): 1234567890
print queue: 1, 2, 3, 4, 5, 6, 7, 8, 9,
How many numbers to be removed from queue: 5
print queue: 6, 7, 8, 9,
Enqueue string (enter exit to stop): aaa bbb ccc ddd eee fff exit
print queue: aaa, bbb, ccc, ddd, eee, fff,
How many strings to be removed from queue: 3
print queue: ddd, eee, fff,
Enqueue employee's id, name, dept (enter id 0 to stop): 1 bob CSE
Enqueue employee's id, name, dept: 2 mary Math
Enqueue employee's id, name, dept: 3 joe Art
Enqueue employee's id, name, dept: 4 Ellen CSE
Enqueue employee's id, name, dept: 0 no no
print queue: 1 bob CSE, 2 mary Math, 3 joe Art, 4 Ellen CSE,
How many strings to be removed from queue: 2
print queue: 3 joe Art, 4 Ellen CSE,
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
Similar questions
- language is c++ sample output included with the user input in boldarrow_forwardIn C++ Could someone Write a program that will read a document/txt file thats written in ASCII and converts it into normal text and then display the text on the screen. I wanna know what some more professional ones look like becaume mine looks pretty jumbledarrow_forwardWrite a C++ program that prompts the user to enter five test scores (decimal) then:• Prints the average of the scores.• Converts the average to an integer value. (Use a constant to store the number of scores).arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education