Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C + + Creating StudentRoster Queue Download and Unzip: o Download Queue.zip and unzip the contents. o Take a moment to understand the functioning of
C Creating StudentRoster Queue
Download and Unzip:
o Download "Queue.zip" and unzip the contents.
o Take a moment to understand the functioning of the queue.
Implement the StudentRosterQueue.h header file and the driver.cpp program.
Exception Handling:
o Create both EmptyQueue and FullQueue classes to handle exceptions.
Testing in driver.cpp:
o Read an input file and add all records to the queue.
o Print all elements in the queue.
o Dequeue multiple times until the EmptyQueue exception occurs.
o Implement a trycatch statement for handling the exception.
o Whenever a dequeue occurs, print all elements in the current queue.
Students.txt :
Betsy A
Sam Spade B
Annie Smith A
Thomas J Jones A
Allan Adaire C
Jennifer Smallville A
Queueh
#pragma once
#include
using namespace std;
struct NodeType
char value;
NodeType next;
;
class Queue
private:
NodeType qFront;
NodeType qRear;
public:
Queue;
~Queue;
bool isEmpty;
bool isFull;
void enqueuechar;
void dequeuechar& x;
void displayQueue;
;
Queue::Queue
qFront qRear NULL;
void Queue::displayQueue
NodeType nodePtr qFront;
while nodePtr NULL
cout nodePtrvalue ;
nodePtr nodePtrnext;
bool Queue::isEmpty
if qFront NULL
return true;
else
return false;
bool Queue::isFull
NodeType ptr new NodeType;
if ptr NULL
return true;
else
delete ptr;
return false;
void Queue::enqueuechar x
if isFull exit;
NodeType newNode new NodeType;
newNodevalue x;
newNodenext NULL;
if qFront NULL
qFront newNode;
else
qRearnext newNode;
qRear newNode;
void Queue::dequeuechar &x
if isEmpty
exit;
x qFrontvalue;
NodeType temp qFront;
qFront qFrontnext;
delete temp;
QueueTestcpp
#include
#include "Queue.h
using namespace std;
int main
Queue q;
char ch;
qenqueuea;
qenqueuec;
qenqueuep;
qenqueued;
qdequeuech;
cout ch: ch endl;
qdisplayQueue;
return ;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started