Create a class template called GenericVector. The class should have the following members:

  • Private Data Member: vec (a vector of type parameter).
  • Public Member Functions:
    • push: This public function should accept an argument and insert its value at the end of the vector. (Hint: can use vectors push_back method)
    • last: This function should accept no argument and return the value of the last element of the vector.
    • print: This function will print all the elements in vector. Use a stream manipulator to ensure that at most 2 digits are printed after decimal.

After you have created the class template, develop a test program (containing main() ) that will do the following:

  • declare an object of GenericVector where the type parameter will be replaced by double.
  • enter at least 3 double values into the vector of object created in (a).
  • use the last function to print the last element of the vector.
  • print all the elements in the vector.
Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.