Answered step by step
Verified Expert Solution
Question
1 Approved Answer
NOTE: Below is the code for the Queue class (because it uses the Node class, I've also put the code for Node there). NOTE: The
NOTE: Below is the code for the Queue class (because it uses the Node class, I've also put the code for Node there).
NOTE: The data type for project 1 is referring to a class I created called Combine. In this class, I wrote code that takes a text file containing information on different football players and their combine results and stores those players as a vector of objects of the class.
Queue.h:
#ifndef NODEB_QUEUE_H #define NODEB_QUEUE_H /* * Queue class * Functionality: push, pop, peek, isEmpty, print */ #include "Node.h" #includeusing namespace std; templatetypename Object> class Queue { private: // Store the address of the top Node in the Queue Node
Node.h:
#ifndef NODEB_NODE_H #define NODEB_NODE_H /** Represents one node to be used in a linked list Contains data (object) and reference to next in list */ templatetypename Object> class Node { private: Object item; Node* next; public: Node(Object newItem) { item = newItem; next = nullptr; } Node(Object newItem, Node* nextNode) { item = newItem; next = nextNode; } void setItem(Object newItem) { item = newItem; } Object getItem() const { return item; } void setNext(Node* nextNode) { next = nextNode; } Node* getNext() const { return next; } }; #endif //NODEB_NODE_HMain function Create three Queue objects: one of integers, one of strings, and one of a custom data type (ideally the type you created in Project 1). Demonstrate that the Queue methods work correctly by calling methods on the objects and printing out to the console when appropriate. Perform the following operations: Create a Queue object and a Stack object, both of the type you created in Project 1. Print and push the first 10 objects from your vector (from Project 1) onto the Queue. . Pop the 10 objects off the Queue and push them onto the Stack. Pop and print the 10 objects off the Stack. What is the order of the objects before and after adding them to the Queue and Stack? When and why did it change? Main function Create three Queue objects: one of integers, one of strings, and one of a custom data type (ideally the type you created in Project 1). Demonstrate that the Queue methods work correctly by calling methods on the objects and printing out to the console when appropriate. Perform the following operations: Create a Queue object and a Stack object, both of the type you created in Project 1. Print and push the first 10 objects from your vector (from Project 1) onto the Queue. . Pop the 10 objects off the Queue and push them onto the Stack. Pop and print the 10 objects off the Stack. What is the order of the objects before and after adding them to the Queue and Stack? When and why did it change
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