Taks-Design a class named NumberClass that has a vector of any data type (use Class Template)....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
C PROGRAM include using namespace std Implement template class Nu... View the full answer
Related Book For
Posted Date:
Students also viewed these accounting questions
-
Two objects are attracting each other with a certain gravitational force. (a) If the distance between the objects is halved, the new gravitational force will (1) increase by a factor of 2, (2)...
-
You want to conduct an experiment with your class to see if students prefer Coke or Pepsi. a. Explain how you could do this, incorporating ideas of blinding and randomization, (i) with a completely...
-
Comment briefly on the main functions of management?
-
In Exercises find the values of x for which the series converges. n=0 (x + 1)n n!
-
The actual amount of coffee (in grams) in a 230- gram jar filled by a certain machine is a random variable whose probability density is given by Find the probabilities that a 230- gram jar filled by...
-
What would be the value of Sanofis R&D asset at the end of fiscal years 2016 and 2017 if the average expected life of its R&D investments is only three years?
-
Is sustainable development a useful, practical perspective for business to adopt? If yes, how is it useful? Explain your view, giving reasons.
-
The specific internal energy of formaldehyde (HCHO) vapor at 1 atm and moderate temperatures is given by the formula U(J/mol) = 25.96T + O.02134T 2 where T is in C. (a) Calculate the specific...
-
Product Decisions Under Bottlenecked Operations Youngstown Glass Company manufactures three types of safety plate glass: large, medium, and small. All three products have high demand. Thus,...
-
During 2020, the following transactions were recorded by the Port Hudson Community Hospital, a private sector not-for-profit institution. 1. Gross charges for patient services, all charged to Patient...
-
Microsoft Corporation's most recent annual report, you will calculate Five financial ratios for the current and prior fiscal year. You will provide analysis and background information on the...
-
You are sweeping the floor with a long-handled broom, with the handle making an acute angle to the horizontal floor. Is it easier to push the broom or pull it? Why? \(\cdot\)
-
Sunlight on Earth has an intensity of about \(S=\) \(1.0 \mathrm{~kW} / \mathrm{m}^{2}\). How much power can be harvested from a solar energy panel that is \(2.0 \mathrm{~m}\) long and \(1.6...
-
A pool ball that is struck gently will roll smoothly across the felt surface of a pool table. However, it is possible to strike the ball in a way that produces "backspin", such that the ball is...
-
Similar to perceived loudness in hearing, the brightness the human eye and brain perceive for light is logarithmic rather than linear. For example, you do not perceive light that has an intensity of...
-
A traveller walks \(30 \mathrm{~m}\) along a train platform, dragging their suitcase behind them using a strap attached to the top. The traveller's hand is \(0.25 \mathrm{~m}\) above the top of the...
-
1. For the Home country draw a graph with the quantity of the two goods on the two axes and explain why at the consumption point the marginal rate of substitution (MRS) must be equal to the autarky...
-
Outline some of the major problems confronting an international advertiser.
-
Explain why the sky may be red in the morning and evening and blue during the day.
-
The AM frequencies on a radio dial range from 550 kHz to 1600 kHz, and the FM frequencies range from 88.0 MHz to 108 MHz. All of these radio waves travel at a speed of 3.00 x 108 m/s (speed of...
-
If designed properly, a good ammeter should have a very small resistance. Why? Explain clearly, using Kirchhoffs laws.
-
Prove that van der Waals constants \((a, b)\) can be expressed in terms of critical temperature and pressure as follows: a = 27 R 2 T 2 c 64 P c b = R T c 8 P c a = 27 R 2 T c 2 64 P c b = R T c 8 P c
-
Justify the following statement with illustration: 'Violation of Kelvin-Planck statement leads to the violation of Clausius statement'.
-
Show that where \[ \left(\frac{\partial U}{\partial V} ight)_{T}=\frac{T \beta}{\kappa}-P \] \(\beta=\) Coefficient of volume expansion \(\kappa=\) Isothermal compressibility.
Study smarter with the SolutionInn App