Details of this Paper

Multifile Project

Description

solution


Question

STEP 1: Create a New Multifile Project;Back to top;Create a new multifile project with three classes: the base class Shape, the class Circle (derived public from Shape), and the class Rectangle (derived public from Shape). The classes will have the following requirements.;The class Shape should be an abstract class with the following pure virtual functions.;area();perimeter();The class Circle should be derived public from the class Shape and override both the area() and the perimeter() functions.;The perimeter() function should correctly calculate the circumference of a circle, given a radius.;The area() function should correctly calculate the area of a circle, given a radius;Include all the necessary accessor and mutator functions to accomplish the requirements of the class.;The class Rectangle should be derived public from the class Shape and override both the area() and the perimeter() functions.;The perimeter() function should correctly calculate the circumference of a rectangle, given its dimensions.;The area() function should correctly calculate the area of a rectangle, given its dimensions.;Include all the necessary accessor and mutator functions to accomplish the requirements of the class.;STEP 2: Create the Test Function;Back to top;Instantiate at least one object of each of the Circle and the Rectangle classes. Provide appropriate constructors for both that will accept the necessary initialization arguments to provide the information required for all the class member functions. Exercise and test each member function of both classes for correct calculations and output.;STEP 3: Add a Base Class Pointer Array and an Additional Function;Back to top;Add to the test function a base class array of pointers of the same dimension as the total number of Circle and Rectangle objects that were created in the previous step. Use this pointer array to access the Circle and the Rectangle objects to call a new, nonclass member function that will display all the information about each object.;Circle objects should display radius, circumference, and area.;Rectangle objects should display dimensions, perimeter. and area.;The information-display function should accept as its calling parameter a pointer of the class Shape.;Run the test function to demonstrate static (early) binding using the derived class objects calling their member functions, and run the test function to demonstrate dynamic (late) binding using the assigned Shape class pointers to call the nonclass, member-display-information function

 

Paper#69496 | Written in 18-Jul-2015

Price : $32
SiteLock