friend ostream& operator<<(ostream&, const TaskManager&); This friend function overloads operator<< to display information about the TaskManager parameter, showing the tasks and their related indices in queue_. You are not allowed to access any slot of queue_ that does not have an active task. Keep in mind that front_ may be smaller than, the same as, or larger than rear_. If there is no task in queue_, the function shall display "Empty Queue" or "No task".

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question

This is my Task.h and I need help making the pictured function Please anything helps


#ifndef TASK_MANAGER_H
#define TASK_MANAGER_H
#include <string>
using namespace std;

struct Task {
  string name;  //name of a task
  unsigned cycles;   //number of cycles a task would require
};

class TaskManager {
  private:
    Task* queue_; //a circular array to hold tasks to be performed
    unsigned capacity_; //the maximum number of tasks allowed
    int front_;  //index for the task in the front of the queue
    int rear_;  //index for the task at the back of the queue
  public:
    TaskManager(unsigned n = 10); 

 friend ostream& operator<<(ostream&, const TaskManager&);
};

#endif

 

friend ostream& operator<<(ostream&, const TaskManager&);
This friend function overloads operator<< to display information about the TaskManager
parameter, showing the tasks and their related indices in queue_. You are not allowed to access
any slot of queue_ that does not have an active task.
Keep in mind that front_ may be smaller than, the same as, or larger than rear_. If there is no
task in queue_, the function shall display "Empty Queue" or "No task".
Transcribed Image Text:friend ostream& operator<<(ostream&, const TaskManager&); This friend function overloads operator<< to display information about the TaskManager parameter, showing the tasks and their related indices in queue_. You are not allowed to access any slot of queue_ that does not have an active task. Keep in mind that front_ may be smaller than, the same as, or larger than rear_. If there is no task in queue_, the function shall display "Empty Queue" or "No task".
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Lists
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning