Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Taks-Design a class named NumberClass that has a vector of any data type (use Class Template). You should create a parameterized constructor that accept
Taks-Design a class named NumberClass that has a vector of any data type (use Class Template). You should create a parameterized constructor that accept the initialization value for the vector. There should also be member functions to perform the following operations: Print (cout) each element stored in the vector. Determine if a number exists in the vector, return true if found, return false otherwise. Return the Max (highest) value stored in the vector. Return the Min (lowest) value stored in the vector. Return the average of all the numbers stored in the vector. Return the number of even numbers stored in the vector. Replace a number at a given indexed-position of the vector. In the main function, two objects of NumberClass are initialized with initialization values. The names of the member functions in the class declaration should match with the names used in the main() function. You'd probably want to comment out the code statements in the main() function first before you finish the code for NumberClass. Once complete, run the code and your output should look exactly as shown below: Print the elements in the vector 99 34 12 44 77 2 37 4 54 68 44 102 5 42 Is 77 in the vector? : true Is 100 in the vector?: false The max value of the vector is 102 The min value of the vector is 2 The average value of the vector is 44 The number of even numbers in the vector is 10 Print the vector after one number is replaced. 99 34 12 44 77 100 37 4 54 68 44 102 5 42 Print the elements in the vector 100.3 32.78 12.12 55.44
Step by Step Solution
★★★★★
3.47 Rating (154 Votes )
There are 3 Steps involved in it
Step: 1
C PROGRAM include using namespace std Implement template class Nu...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