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 0 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.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 14RQ
icon
Related questions
Question

Please use easy logic with proper indentations and comments for understanding!. Coding should be 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 0 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 @file 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.

A makefile must also be submitted for this exercise.

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 6 images

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning