Question: Implement CandidateQueue.cpp MUST BE IN C++ source.cpp file /* In this program, we have a line of candidates, some are developer and some are designer.

Implement CandidateQueue.cpp

MUST BE IN C++

source.cpp file

/* In this program, we have a line of candidates, some are developer and some are designer. When we want to create a team, we need one deisgner and one developer. The candidates are all standing in the line. */ #include  #include "CandidateQueue.h" using namespace std; int main() { // Variables used for testing Candidate daniela("Daniela", "Developer"); Candidate hector("Hector", "Salesman"); Candidate berta("Berta", "Designer"); Candidate hugo("Hugo", "Salesman"); Candidate bernardo("Bernardo", "Designer"); Candidate daria("Daria", "Developer"); CandidateQueue q; q.push_cadidate(&daniela); q.push_cadidate(&hector); q.push_cadidate(&berta); q.push_cadidate(&hugo); q.push_cadidate(&bernardo); q.push_cadidate(&daria); /* The output should be There is a salesman in the line. First one called Hector There is a designer in the line. First one called Berta There is no one with marketing specialty *********** */ string c = q.Exist("Salesman"); if (c == "") cout << "There is no one with salesman specialty "; else cout << "There is a salesman in the line. First one called " << c << endl; c = q.Exist("Designer"); if (c == "") cout << "There is no one with designer specialty "; else cout << "There is a designer in the line. First one called " << c << endl; c = q.Exist("Marketing"); if (c == "") cout << "There is no one with marketing specialty "< 

CandidateQueue.h FILE

#pragma once #include "Candidate.h" class CandidateQueue { public: class Node { public: Candidate* c; Node* next; }; // Constructor: initialize head, tail and count CandidateQueue(); // Pushes a pointer to a candidate onto the back of the line (the info of Node is a pointer to Candidate :D ). // update head, tail and count void push_cadidate(Candidate *p); // Check the line and see if there is any candidate with the give role in the line (the line is implemented in linked list) // If there is, return the name of that candidate // If no such candidate exists, returns "". string Exist(string role); private: Node* head; Node* tail; int count; }; 

CandidateQueue.cpp file

#include "CandidateQueue.h"

#include

using namespace std;

CandidateQueue::CandidateQueue()

{

count = 0;

head = nullptr;

tail = nullptr;

}

void CandidateQueue::push_cadidate(Candidate* p) {

//To DO

}

string CandidateQueue::Exist(string r) {

//To DO

}

Candidate.h

#pragma once #include  using namespace std; class Candidate { public: // Initializes a player with the given name and role. role is either developer or designer Candidate(string name, string role); // Returns the name of the player string name(); // Returns the role of the player string role(); private: string _name; string _role; }; Candidate.cpp
#include "Candidate.h" Candidate::Candidate(string name, string role) { _name = name; _role = role; } string Candidate::name() { return _name; } string Candidate::role() { return _role; } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!