Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the following using C++ Task 1: Create a queue class that will be used as the basis for the task 3 1. 2. Create

Complete the following using C++

image text in transcribed

Task 1: Create a queue class that will be used as the basis for the task 3 1. 2. Create a new project. You can name this whatever you like. Design a queue class using an array (or a vector) to store data. This class should be a template. Include the standard functions for a queue. The constructor should include a parameter to indicate the size of the array. b. a. The array holding the data should be an array of pointers. c. The enqueue function should accept a pointer and add that pointer to the back of the queue. It doesn't need to create any memory. d. The dequeue function should return a pointer. It doesn't need to delete any memory e. The peekFxnt function should return a pointer to the item on the front of the queue without removing it. f. The length function will return an int indicating the number of items in the queue. The empty function should empty the stack of all contents. It needs to call delete g. to avoid memory leaks. It doesn't need to return any value. The queue should declare a friend function that can access the underlying array for the purposes of printing it to the screen. h. 3. 4. Design a test program for your class. The test program should test all the implemented 5. Create the implementation code for the above functions as required. Do not use cout in the class. Any errors such as overflow or underflow should throw a custom class error. functions. This should test both expected success conditions and expected error conditions Include in the lab report a screen shot(s) of the output of your test program. Include a discussion of how you designed your test program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Step: 3

blur-text-image

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

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions