Question: Create a template class named VectorController. This class has 1 data member a vector; The class should contain 3 constructors : a default constructor, a

Create a template class named VectorController. This class has 1 data member a vector; The class should contain 3 constructors: a default constructor, a constructor that accepts the size of the vector, and a constructor that accepts the size and default value for the vector. The class should also contain the following functions:

Function Definition
setVector sets the value of the vector data member
getVector returns the vector data memeber
setIndexValue sets the value of a specific index in the vector to the value provided by the user or pushes the value to end of the vector if the index does not exist.
getSize returns the size of the vector
minimumValue returns the smallest value in the vector
maximumValue returns the largest value in the vector

Also overload the insertion stream operator (<<). This function should be templated so that you may use the same function with cout and fstream. The output should be as below.

You are provided a driver file to test your code. Do not change its contents.

Hints: (1) All methods are written inside the H file. Refer to the chapter for examples. (2) Use the resize function in the overloaded constructors. (3) The overloaded operator function implementation must be written inside the class definition. Other functions should be written just outside of the declaration in the H file.

Hello I was given the driver.cpp file:

#include #include #include #include #include #include "VectorController.h"

using namespace std;

int main() { VectorController list1; VectorController list2(10); VectorController list3(8, 2); cout << "List 1 Size: " << list1.getSize() << endl; cout << "List 2 Size: " << list2.getSize() << endl; cout << "List 3 Size: " << list3.getSize()<< endl; cout << endl << endl << "Printing List Values" << endl << endl; cout << "List 1" << endl << list1 << endl; cout << "List 2" << endl << list2 << endl; cout << "List 3" << endl << list3 << endl; cout << "Update List 2" << endl; vector test = {"my","first", "name", "is", "not", "written"}; list2.setVector(test); cout << "List 2 Size: " << list2.getSize() << endl; cout << "List 2" << endl << list2 << endl; list3.setIndexValue(7, 60002); cout << "Update List 3" << endl; cout << "List 3" << endl << list3 << endl; cout << fixed << setprecision(3); cout << "List " << setw(10) << left << "Min" <

Now I need VectorController.h file and I need it in C++ thank you!

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!