Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this third part of the signature assignment, you will develop code for additional classes to analyze the data. Inheritance will be used to relate

In this third part of the signature assignment, you will develop code for additional classes to analyze the data. Inheritance will be used to relate the analyzer classes into a hierarchy.
Modify the Analyzer class to make it a base class by changing the analyze method to make it a pure virtual function; adding a virtual function means the class is intended to be a base class. Change the analyze method to virtual. Because Analyzer has at least one virtual function, the destructor should be marked virtual; its implementation remains the same since the class owns the integer array. Change the values and size variables from private to protected.
Create a class called DuplicateAnalyser that publicly inherits from Analyzer. This class will scan the data and determine which values appear more than once. Add a constructor that takes an integer array and its size. The constructor should call the base class constructor and pass these parameter values. Implement the analyze method to count the duplicated values; use the override keyword appropriately. Return a std::string with explanatory text and the count of duplicates. Only some values will be duplicated, and others will not exist or appear only once.
Create a second class called MissingAnalyzer that publicly inherits from Analyzer. This class will scan the data and determine which values do not appear. Add a constructor that takes an integer array and its size. The constructor should call the base class constructor and pass these parameter values. Implement the analyze method to count the missing values; use the override keyword appropriately. Return a std::string with explanatory text and the count of missing values. Only some values will be missing, and others will be duplicated or appear only once.
Create a third class called StatisticsAnalyzer, which performs the same statistical analysis of the data as the Analyzer class did in Part 2. This includes the minimum, maximum, and mean values. Add a constructor that takes an integer array and its size. The constructor should call the base class constructor and pass these parameter values. Implement the analyze method using the code from the Analyzer class and use the override keyword appropriately.
Modify the Analyzer class to remove the implementation of the analyze method and make it a pure virtual function.
Modify the main function to create an instance from each of the StatisticsAnalyzer, DuplicateAnalyzer, and MissingAnalyzer classes. Call the analyze method for each instance and print out the returned results.
Use these function and class headers:
class Analyzer
void cloneValues(int* values, int size)
Analyzer(int* values, int size)
virtual ~Analyzer()
virtual std::string analyze()=0
class StatisticsAnalyzer : public Analyzer
StatisticsAnalyzer(int* values, int size)
std::string analyze() override
class DuplicateAnalyzer : public Analyzer
DuplicateAnalyzer(int* values, int size)
std::string analyze() override
class MissingAnalyzer : public Analyzer
MissingAnalyzer(int* values, int size)
std::string analyze() override
Example output:
The minimum value is 0
The maximum value is 999
The mean value is 499.495
There were 269 duplicated values
There were 361 missing values

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

Step: 3

blur-text-image

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions