Question: In this second part of the signature assignment, develop code for classes to read and analyze binary data. Write a function named createBinaryFile ( )

In this second part of the signature assignment, develop code for classes to read and analyze binary data.
Write a function named createBinaryFile(). Place the code for creating the array of random values in it. In it, add a call to the existing writeBinary() function. Modify writeBinary() to take an additional parameter which is the file name. Call writeBinary() passing the name as binary.dat, a pointer to the array, and the size. It is recommended that a constant named SIZE be created and assigned to the value 1000. This simplifies reading the code.
Write a class called BinaryReader. It should have instance variables of an integer pointer and an integer. The pointer will point to an array of integers; the integer will hold the arrays size. Add a private method called readValues() which uses the readBinary() code to input the size and the values of an array of integers. Eliminate the existing readBinary() function. Add a destructor to delete the integer array. Then add two public methods named getValues() and getSize() that return the instance variables. Finally, add a constructor that takes a single parameter, a constant character pointer to a file name. The constructor should call the readValues() method to populate the array.
Write a second class called Analyzer. This class has two instance variables, an integer pointer and an integer representing an array of integers and the arrays size. Add a constructor that takes two parameters, an integer pointer and an integer, and initialize the instance variables from these. Add a private cloneValues() method that creates an integer array and copies the values from the parameter array. The constructor should call the cloneValues() method. Add a destructor to delete the array. Add an analyze() method. This method should determine the mean (mathematical average), minimum value, and maximum value from the values in the array. Create a string that holds this information and return it from the function.
Use these function and class headers:

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 Databases Questions!