Question: 10. Number Array Class Design a class that has an array of floating-point numbers. The constructor should accept an integer argument and dynamically allocate the

10. NumberArrayClass

Design aclassthat has anarrayof floating-point numbers. Theconstructorshould accept aninteger

argumentand dynamically allocate thearrayto hold that many numbers. Theprivatedata members of

theclassshould include theintegerargumentin avariableto hold the size of thearrayand a

pointer to floattypeto hold the address of the firstelementin thearray.

The destructor should free the memory held by thearray.

In addition, there should be member functions to perform the followingoperations:

Storea number in anyelementof thearray

Retrieve a number from anyelementof thearray

Return the highestvaluestoredin thearray

Return the lowestvaluestoredin thearray

Return the average of all the numbersstoredin thearray

Demonstrate theClassin aProgram

SAMPLE RUN #0:./Dynamic-Number-Class-Array

Interactive Session

Standard Error (empty)

Standard Output

Hide Invisibles

Highlight:

None

Standard Input Only

Prompts Only

Standard Output w/o Prompts

Full Standard Output

All

Show Highlighted Only

CreatingaFloatClassArrayObjectwithasizeof5.UsingsetIfunctionwithcalls(0,1.4),(1,2.3),(2,3.13),(3,6.66),(4,7.711)toloadarray. UsinggetIwithalllegitmateindexvaluestoprintarray. ThevalueoffArray1[0]=1.4 ThevalueoffArray1[1]=2.3 ThevalueoffArray1[2]=3.13 ThevalueoffArray1[3]=6.66 ThevalueoffArray1[4]=7.711 CallinggetHireturnshighestvalueinarrayas:7.711 CallinggetLowreturnslowestvalueinarrayas:1.4 CallinggetAvgreturnstheaverageofthearrayas:4.2402 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!