Starting from:

$29.99

Lab 02 - Array Counting Problems

Lab 02 - Array Counting Problems
Direction: Submit typed work in the Labs directory of your github repository and/or dropbox. Each part should be a
separate files. The files named should be ''lab2A.cpp'' and ''lab2B.h'' respectively. Do not inlude any additional libraries than
the ones included in the accompanying ''Shapes.h''.
Part A: In class
Your objective is to write a program that defines the following function
 Define an int function named Occurrences() that takes a double array parameter, an int parameter and a
double parameter respectively. Given that the int parameter represents the size of the array parameter, the
function returns the total number of occurrences of the double parameter.
Part B: Take home
Your objective is to define the class named Ellipse that publicly inherits the Shape interface from the accompanying
header file Shape.h. For the class, you must include the following:
 A private double array field for each of the radius of the ellipse.
 A public default constructor that assigns 1 to each element of the field.
 A public overloaded constructor that takes two double parameters. It assigns the parameters to their respective
elements of the field.
 A public copy constructor.
 A public assignment operator.
 A public empty destructor.
 A public overridden Perimeter() method. It returns the perimeter of the ellipse.
 A public overridden Area() method. It returns the area of the ellipse.
 A public overridden ToString() method. It returns a string of all the radii enclosed in curly braces. The radii
most have two decimal places.
 A friend overloaded ostream operator. It displays the elements of the field in the same format as ToString().

More products