Question: I need help completing main.cpp using what I have given: the header, MyVector.h doesn t need changed, MyVector.hpp is almost done but I can t

I need help completing main.cpp using what I have given: the header, MyVector.h doesnt need changed, MyVector.hpp is almost done but I cant figure out operator= and copy contructor functions. How would I finish the main to satisfy the requirements shown with the input and output samples?
MyVector.h below:
#ifndef MYVECTOR_H
#define MYVECTOR_H
#include
#include
#include
using std::cerr;
using std::cin;
using std::cout;
using std::endl;
using std::string;
class ArrayListIterator {
int index;
public:
ArrayListIterator(int i) : index(i){}
operator int(){
return index;
}// allows Iterator to be used like an int/index
ArrayListIterator operator+(int increment){
index += increment;
return *this;
}// allows +/++
bool operator>(int comp){ return index > comp; }
bool operator(int comp){ return index comp; }
};
template class MyVector {
private:
T *data = nullptr;
int max_elements;
int num_elements;
public:
// Just a simple default constructor.
MyVector() : max_elements(4), num_elements(0){ data = new T[4]; }
~MyVector();
const MyVector &operator=(const MyVector &source);
MyVector(const MyVector &source);
T &operator[](int index);
T &at(int index);
T &front();
T &back();
unsigned int capacity();
void reserve(int new_max_elements);
void shrink_to_fit();
void clear();
void push_back(const T &value);
void pop_back();
void insert(ArrayListIterator position, const T &value);
void erase(ArrayListIterator position);
unsigned int size();
int find(const T &value);
void swap(MyVector &other);
ArrayListIterator begin(){ return ArrayListIterator(0); }
ArrayListIterator end(){ return ArrayListIterator(num_elements); }
};
template
std::ostream &operator(std::ostream &out, MyVector &my_list){
out "[";
for (int i =0; i my_list.size(); i++){
out my_list.at(i)",";
}
out "]";
return out;
}
#include "MyVector.hpp"
#endif
Main.cpp below:
#include "MyVector.h"
#include
#include
using namespace std;
void print_schedule(MyVector &theVector);
void add(MyVector &theVector, const string &jobTitle, int timeSlot);
void fire(MyVector &theVector, const string &jobTitle);
void sleepIn(MyVector &theVector, int time);
void carCrash(MyVector &theVector, int timeSlot);
void disease(MyVector &theVector);
int main(){
MyVector schedule;
string startingJob;
for (int i =0; i 3; i++){
cin >> startingJob;
schedule.push_back(startingJob);
}
string func ="";
int total_days;
cin >> total_days;
for (int day =0; day total_days; day++){
// Finish me!
}
return 0;
}
/*
"Suggested" functions below.
Feel free to complete them, change them, or ignore them,
the correct output is all you will be graded on
*/
void print_schedule(MyVector &theVector){
int numJobs = theVector.size();
if (numJobs ==0)
cout "Unemployed" endl;
else {
for (int i =0; i numJobs -1; i++){
cout theVector[i]"";
}
cout theVector[numJobs -1] endl;
}
}
// add function - Inserts job in the given time slot
// If timeslot >= len of MyVector is passed,
// job is appended to the end.
void add(MyVector &theVector, const string &jobTitle, int timeSlot){}
// If he is fired from a specific job, it goes
// through his schedule from back to front,
// erasing each instance of that job from his schedule
void fire(MyVector &theVector, const string &jobTitle){}
// Perform the "Sleep in" event
void sleepIn(MyVector &theVector, int time){}
// Perform the "Car crash" event
void carCrash(MyVector &theVector, int timeSlot){}
// Perform the "Disease" event
void disease(MyVector &theVector){}
And the myVector.hpp is split between two photos attached
I need help completing main.cpp using what I have

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 Programming Questions!