Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In C++ 3. Define a class which stores up to 10 integer values in an array. The class should also define the following 4 public
In C++
3. Define a class which stores up to 10 integer values in an array. The class should also define the following 4 public methods: setNumber - accepts an integer value to store in the array. The value is stored in the next available element of the array (first call to the method stores the value in element O with the second call storing the value in element 1.) The method returns true if there is room in the array and the integer was successfully stored. Returns false otherwise. clear - removes all values from the array so that the array can be reused. displayNumbers - displays the values currently stored in the array. getStats - determines the largest, smallest, and average of the values currently stored in the array. These values are returned to the caller via reference parameters. All methods should produce correct results regardless of the order in which the methods are called. Thus, calling displayNumbers prior to setNumber will produce an appropriate result. Correct results should be produced regardless of the number of values stored. A specification file (h) and an implementation file (cpp) for the class are required. The specification should be documented using Javadoc documentation comments for all public members. The @author @file@param and @return Javadoc tags should be used as appropriate. The implementation file requires only a single Javadoc documentation comment at the top of the file which includes the @author and @fhle tags. Also develop a Client to utilize your class. A sample run is shown below; your output does not need to match the sample. Other tests are recommended to thoroughly test all methods of the class. Enter number 1 12 Enter number 2: 15 Enter number 3: 87 Enter number 4: 45 Enter number 5 52 Enter number 6: 62 Enter number 7: 32 Enter number 8 25 Enter number 9: 4 Enter number 10: 75 The numbers are 12, 15, 87, 45, 52, 62, 32, 25, 4, 75 The values range from 4 to 87 with an average value of 40.90 2 2 5 2 Do you have another set of 10 numbers? (y or n): y Enter number 1: 100 Enter number 2: 100 Enter number 3 100 Enter number 4: 100 Enter number 5 100 Enter number 6: 100 Enter number 7: 100 Enter number 8: 100 Enter number 9 100 Enter number 10: 100 The numbers are 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 The values range from 100 to 100 with an average value of 100.00 9 0 0 2 Do you have another set of 10 numbers? (y or n): nStep 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