Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in C++ ARRAYHELPER CLASS TEMPLATE Create a class specification (ArrayHelper.h) & class implementation (ArrayHelper.cpp) file for a class template named ArrayHelper The purpose of the
in C++
ARRAYHELPER CLASS TEMPLATE Create a class specification (ArrayHelper.h) & class implementation (ArrayHelper.cpp) file for a class template named ArrayHelper The purpose of the ArrayHelper template class is to perform common array functions on any numerical data type. ArrayHelper should have the following attributes: A pointer to an array of the template type An integer containing the number of elements in the array ArrayHelper should have the following member functions: Constructor, which accepts a pointer to an array and an integer containing the number of elements in the array. The constructor should set the number of elements attribute to the number sent to this function. Then, the constructor should create a NEW array of the same size and then copy the array elements from the array parameter into the ArrayHelper object's array. Destructor- should release the dynamically allocated array getMax function -should find the largest number in the array and return the integer index of the element that contains the largest number. getMin function-should find the smallest number in the array and return the integer index of the element that contains the smallest number. getTotal function- should find the total of all the elements and return the total getAvg function-should find the average of all the elements (hint: you can call the getTotal function!) ARRAYHELPER CLASS TEMPLATE Create a class specification (ArrayHelper.h) & class implementation (ArrayHelper.cpp) file for a class template named ArrayHelper The purpose of the ArrayHelper template class is to perform common array functions on any numerical data type. ArrayHelper should have the following attributes: A pointer to an array of the template type An integer containing the number of elements in the array ArrayHelper should have the following member functions: Constructor, which accepts a pointer to an array and an integer containing the number of elements in the array. The constructor should set the number of elements attribute to the number sent to this function. Then, the constructor should create a NEW array of the same size and then copy the array elements from the array parameter into the ArrayHelper object's array. Destructor- should release the dynamically allocated array getMax function -should find the largest number in the array and return the integer index of the element that contains the largest number. getMin function-should find the smallest number in the array and return the integer index of the element that contains the smallest number. getTotal function- should find the total of all the elements and return the total getAvg function-should find the average of all the elements (hint: you can call the getTotal function!)
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