Create a multifile project with the base class Shape, the class Circle (derived
ID: 3645204 • Letter: C
Question
Create a multifile project with the base class Shape, the class Circle (derived public from Shape), and the class Rectangle (derived public from Shape).1. 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.
Explanation / Answer
#include #include #include class shape { protected: double b; double h; public: shape(double b1) { b=b1; } shape(double b1,double h1) { b=b1; h=h1; } virtualvoid disp_area()=0; }; class triangle :public shape { public: circle(double b1):shape(b1) { } void disp_area(); }; class rectangle:public shape { public: rectangle(double b1,double h1):shape(b1,h1) { } void disp_area(); }; void circle::disp_area() { double a1; a1=(b*b)*3.14; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.