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.

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

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!