Question
For your lab, you will implement a template class with the following members: An array of our generic type. The size of this array should
For your lab, you will implement a template class with the following members:
An array of our generic type. The size of this array should be determined by an integer argument to the constructor.
An integer for storing the array size.
A constructor capable of accepting one integer argument. The constructor should initialize the array and set the array size.
A method, findMax, that returns the maximum value in the array.
A method, findMin, that returns the minimum value in the array.
Additionally you will need to create a short driver program that demonstrates your template class working with a few different numeric data types.
When you are done, submit the completed .cpp file (or files, if using additional files for the class) through the Blackboard submission tool. Name the source file [FirstInitial][LastName]_Lab2.cpp. For instance, my submission would be LSilcox_Lab2.cpp.
CHALLENGE
Test your program using integers, doubles, and chars. For each test, randomize the values stored in the initial array. Each type will need its own randomization method (to ensure integers for the integers array, decimal values for the doubles, and letters for the chars). Because of this, you will likely not want to include the randomization code in the template class itself.
C++
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started