Question: In CPP This program is an exercise in using template classes and template functions. Pass in your completed program (-sRa file only) to albertcasavant@gmail.com with
This program is an exercise in using template classes and template functions. Pass in your completed program (-sRa file only) to albertcasavant@gmail.com with the subject line: 250 Program 02. For this program you will implement a queue that can contain either integers, characters, or doubles. A queue is a data structure that accepts new items to be stored at the front of the queue and takes away items previously stored from the back of the queue. Thus, this is a FIFO, first in first out data structure, method of storing items. items are added to the front of the queue items are removed from the back of the queue You will declare a template class for the queue. The queue will be implemented using an array of size 3. The array will be used as a circular array. This means that, for example, if the current frontIndex of the array is 2, and another item must be added to the queue, then frontIndex must be incremented. Since the array has 3 elements, the index must go from 2 to 0, baskJndAKworks the same way. This is implemented using the modulus operator The class will bav3 data members: an array of SIZE 3 called q, . two indexes for use with the array, frontIndex and backIndex The class will have three member functions: a constructor a function purront(T ) that will put a new item on the front of the queue. is the item to be stored. Type T can be integer, character, or double. a function getBack queue that will get a previously stored item from the back of the
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
