Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 binarydat, a pointer to the array, and the size. It is recommended that a constant named SIZE be created and assigned to the value 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
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