Write Program Following Base Class Shape Ifdndef Shapeh Define Shapeh Include Using Names Q13397585

A. Write a program with the following

Base class Shape: #ifdndef SHAPE_H #define SHAPE_H #includeusing namespace std; class Shape { public: Shape(string _name);virtual double getPerimeter() = 0; virtual double getArea() = 0;virtual void display() = 0; //Display all the properties of theShape (name, perimeter, area and if applicable radius, lengh,height etc..) string getName() const; private: string name; //Nameof the Shape }; #endif

1. Publicly derive from class Shape, a Triangle, Rectangle andCircle classes (30%)

2. Publicly derive from class Rectangle, a Square class(10%)

3. Publicly derive from class Triangle, an Equilateral class(10%)

4. Test the program with the following Driver: (50%)

int main() { vector vec; //1. Randomly generate ten differentrandom Shapes (Triangle, Circle, Equilateral, Rectangle or Square)with random sizes (the random length, height, radius are between1.3 – 20.5). Store these shapes in the vector vec. //2. For eachshape, invoke the display() function system(“pause”); return 0;}

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *