Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Shape functions :These functions serve to introduce the concept of polymorphism and object - oriented programming. You will be programming two types of objects that
Shape functions :These functions serve to introduce the concept of polymorphism and objectoriented programming. You will be programming two types of objects that represent shapes. The rectanglet type represents a rectangle shape with a width and length. The trianglet type represents an equilateral triangle with a length. Both types are based on a base shapet type that corresponds to the base class in an objectoriented language.
DO NOT INCLUDE ANY OTHER LIBRARIESFILES
Returns the area of a rectangle
The shape is guaranteed to be a valid rectangle
double rectangleareavoid shape
rectanglet rectangle rectangletshape;
IMPLEMENT THIS
return ;
Returns the area of an equilateral triangle
The shape is guaranteed to be a valid triangle
The area of an equilateral triangle is sqrt times length squared
double triangleareavoid shape
trianglet triangle triangletshape;
IMPLEMENT THIS
return ;
Returns the perimeter of a rectangle
The shape is guaranteed to be a valid rectangle
double rectangleperimetervoid shape
rectanglet rectangle rectangletshape;
IMPLEMENT THIS
return ;
Returns the perimeter of an equilateral triangle
The shape is guaranteed to be a valid triangle
double triangleperimetervoid shape
trianglet triangle triangletshape;
IMPLEMENT THIS
return ;
Initializes a rectangle shape
void rectangleconstructrectanglet shape, const char name, double width, double length
IMPLEMENT THIS
Initializes a triangle shape
void triangleconstructtrianglet shape, const char name, double length
IMPLEMENT THIS
Compares the area of shape with shape
Returns if the area of shape is less than the area of shape
Returns if the area of shape is greater than the area of shape
Returns if the area of shape is equal to the area of shape
int comparebyareashapet shape shapet shape
IMPLEMENT THIS
return ;
Compares the perimeter of shape with shape
Returns if the perimeter of shape is less than the perimeter of shape
Returns if the perimeter of shape is greater than the perimeter of shape
Returns if the perimeter of shape is equal to the perimeter of shape
int comparebyperimetershapet shape shapet shape
IMPLEMENT THIS
return ;
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