Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in C++ we discussed how to create a class that models the operation of a data structure known as stack, which operates according to the

in C++ we discussed how to create a class that models the operation of a data structure known as “stack”, which operates according to the Last-In-First-Out (LIFO) rule. In this problem, we will create a class for another data structure known as “queue”, which operates using the FirstIn-First-Out (FIFO) rule.

The queue class should support the following features:

• Enqueue: Inserts a new element at the rear of the queue.

• Dequeue: Removes the front element of the queue and returns it.

• Peek: Returns the front element present in the queue without dequeuing it.

• IsEmpty: Checks if the queue is empty.

• IsFull: Checks if the queue is full.

• Size: Returns the total number of elements present in the queue. The task is to create a class that supports these features. You can create any appropriate functions you see fit to support these features. You are also required to create any supporting functions in the class for appropriate use of the class such as constructors, destructors, getters,and setters. You also should create a “main” program with statements that test every one of the features above.

You can only use basic data types inside your code (int, double, char, string, array). The queue class you create can support only one of those basic types, similar to what we did in class with the stack class. • You should not use inheritance, polymorphism, templates, vectors in your code.

in C++

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Heres a simple implementation of a queue class in C include iostream class Queue private int arr int ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Elementary Statistics

Authors: Neil A. Weiss

8th Edition

321691237, 978-0321691231

More Books

Students also viewed these Operating System questions