Question
You will need to write the following - shape.hpp class declaration with no implementation Your class must be called Shape You need to have include
You will need to write the following -
shape.hpp class declaration with no implementation Your class must be called Shape You need to have include guards (#ifndef, #define, and #endif) Members Note I am not telling where to put them: private, public, or protected. You must make this determination int numSides Default constructor that can take a single int will assign the passed int to numSides if no value is passed numSides must equal 1 double area() return 1 double perimeter() return 1 int getSides() will return the value of numSides shape.cpp write the implementation of Shape circle.hpp class declaration with no implementation Your class must be called Circle Your class must inherit from Shape Private members double radius Other members Default constructor that can take a single double must call Shapes constructor and send it 0 will assign the passed double to radius if no value is passed radius must equal 1 double area() Note that this is overloaded from Shape if the radius is equal to 1 return 0 return the area of the circle. Use 3.14 for pi (pi*radius^2) double perimeter() Note that this is overloaded from Shape if the radius is equal to 1 return 0 return the perimeter/circumference of the circle. Use 3.14 for pi (2*pi*radius) circle.cpp write the implementation of Circle rectangle.hpp class declaration with no implementation Your class must be called Rectangle Your class must inherit from Shape Private members double side1 double side2 Other members Default constructor that can take two doubles must call Shapes constructor and send it 4 will assign the first argument to side1 will assign the second argument to side2 if no value is passed either argument they must equal 1 double area() Note that this is overloaded from Shape if any of the sides is equal to 1 return 0 return the area of the rectangle: width*length double perimeter() Note that this is overloaded from Shape if any of the sides is equal to 1 return 0 return the perimeter of the rectangle: 2*width + 2*length rectangle.cpp write the implementation of Rectangle
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