Answered step by step
Verified Expert Solution
Link Copied!

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics Of A Networked World Semantics For Grid Databases First International Ifip Conference Icsnw 2004 Paris France June 2004 Revised Selected Papers Lncs 3226

Authors: Mokrane Bouzeghoub ,Carole Goble ,Vipul Kashyap ,Stefano Spaccapietra

2004 Edition

3540236090, 978-3540236092

More Books

Students also viewed these Databases questions