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!
-
Suppose a random sample of 197 accounts from a corporate credit card database revealed a sample average balance of $2,325 with a standard deviation of $144. Use the sample information to develop a...
-
Rhonda Dunbar served as executive director of Downtown Forest Lake, an organization created to revitalize Forest Lake, Minnesota. Over the course of 11 years, Dunbar embezzled $444,000. How did...
-
a. Why is documentation important to (1) management and (2) the auditor? b. Distinguish between a computer run and a run manual.
-
Relaxing Recliner Chairs completed the following selected transactions: 2011 Jul 1 Sold inventory to Great Mart, receiving a $45,000, nine-month, 12% note. Ignore cost of goods sold. Oct 31 Recorded...
-
Apply Prim's algorithm to the following graph. 7 a 2 24 0 5 e
-
Toledo Custom Manufacturing (TCM) makes machined steel parts to customer specification. They have a variety of machines that can hold tight tolerances. In this case they have just received an order...
-
Paula Sanchez is trying to determine her2019finances. Paula's actual2018finances were as follows: Income: Assets: Gross income $69,000Checking account $1,940 Interest income450Savings account9,150...
-
A $2.4 million contract has a 8% Advance payment, amortized at 25%, and a retention of 6%. The Contractor had completed a cumulative value of $503,000 worth of work on the project up to the previous...
-
M. Handy is a self-employed painter who earned $32,400 last year. Her FICA tax rate is 15.3% of her earnings. How much FICA tax did she pay?
-
Suppose the North Carolina University system tests the idea that computerization of statistics classes increases student performance in the courses. If the computers are found to have a beneficial...
-
Susmel Inc. is considering a project that has the following cash flow data. What is the project's payback? Year 0 1 2 3 Cash flows -$350 $150 $200 $300
-
A(n) 70-g ice cube at O C is placed in 810 g of water at 28 o C. What is the final temperature of the mixture?
-
Sagacity Tea simplified Income Statement for 2017 Revenues (97,542 cases @ $25.63/case) $2,500,000 Cost of Good Sold (40%) 1,000,000 Logistics (3.5% of sales less distributor fees) 79,650 Distributor...
-
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.
-
Identify at least four methods by which investors and/or the entrepreneur in a new venture can harvest their investment in a new venture. Describe the costs and benefits of each, and provide a...
-
What are the key distinctions between corporate finance and entrepreneurial finance?
-
Explain what underpricing is and review the various explanations for why it might occur. How does underpricing figure into the cost of going public?
Study smarter with the SolutionInn App