Question: I need help completing main.cpp using what I have given: the header, MyVector.h and MyVector.hpp doesn t need changed. What would the main function code
I need help completing main.cpp using what I have given: the header, MyVector.h and MyVector.hpp doesnt need changed. What would the main function code look like using what I have already? Solving the main function code so the input and output given are solved Please show with actual code, C
MyVector.h below:
#ifndef MYVECTORH
#define MYVECTORH
#include
#include
#include
using std::cerr;
using std::cin;
using std::cout;
using std::endl;
using std::string;
class ArrayListIterator
int index;
public:
ArrayListIteratorint i : indexi
operator int
return index;
allows Iterator to be used like an intindex
ArrayListIterator operatorint increment
index increment;
return this;
allows
bool operatorint comp return index comp;
bool operatorint comp return index comp;
;
template class MyVector
private:
T data nullptr;
int maxelements;
int numelements;
public:
Just a simple default constructor.
MyVector : maxelements numelements data new T;
~MyVector;
const MyVector &operatorconst MyVector &source;
MyVectorconst MyVector &source;
T &operatorint index;
T &atint index;
T &front;
T &back;
unsigned int capacity;
void reserveint newmaxelements;
void shrinktofit;
void clear;
void pushbackconst T &value;
void popback;
void insertArrayListIterator position, const T &value;
void eraseArrayListIterator position;
unsigned int size;
int findconst T &value;
void swapMyVector &other;
ArrayListIterator begin return ArrayListIterator;
ArrayListIterator end return ArrayListIteratornumelements;
;
template
std::ostream &operatorstd::ostream &out, MyVector &mylist
out ;
for int i ; i mylist.size; i
out mylist.ati;
out ;
return out;
#include "MyVector.hpp
#endif
Main.cpp below:
#include "MyVector.h
#include
#include
using namespace std;
void printscheduleMyVector &theVector;
void addMyVector &theVector, const string &jobTitle, int timeSlot;
void fireMyVector &theVector, const string &jobTitle;
void sleepInMyVector &theVector, int time;
void carCrashMyVector &theVector, int timeSlot;
void diseaseMyVector &theVector;
int main
MyVector schedule;
string startingJob;
for int i ; i ; i
cin startingJob;
schedule.pushbackstartingJob;
string func ;
int totaldays;
cin totaldays;
for int day ; day totaldays; day
Finish me
return ;
"Suggested" functions below.
Feel free to complete them, change them, or ignore them,
the correct output is all you will be graded on
void printscheduleMyVector &theVector
int numJobs theVector.size;
if numJobs
cout "Unemployed" endl;
else
for int i ; i numJobs ; i
cout theVectori;
cout theVectornumJobs endl;
add function Inserts job in the given time slot
If timeslot len of MyVector is passed,
job is appended to the end.
void addMyVector &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 fireMyVector &theVector, const string &jobTitle
Perform the "Sleep in event
void sleepInMyVector &theVector, int time
Perform the "Car crash" event
void carCrashMyVector &theVector, int timeSlot
Perform the "Disease" event
void diseaseMyVector &theVector
And the myVector.hpp is split between two photos attached
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
