Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ PLEASE SHOW STEP BY STEP WITH //COMMENTS 3. Consider the classes described below: Class Shape Circle Rectangle Data Members Basex Basex Basex Basey Basey
C++
PLEASE SHOW STEP BY STEP WITH //COMMENTS
3. Consider the classes described below: Class Shape Circle Rectangle Data Members Basex Basex Basex Basey Basey Basey Radius Length Width Methods Shapel) Circle() Rectangle() (Function Members) Getxo) Getxo) Getxo) GetY() GetY() GetY() Movel) Move() Movel) GetRadius() GetLength() SetRadius() GetWidth() SetSides() Figure out the inheritance relation between these classes and based on this inheritance relation write down the full Shape, Circle, and Rectangle class definitions. The constructor of the base classwill prompt the user to enter the data members directly from the keyboard and the constructors of the derived classes will receive their data member values as parameters from the main() functions. These parameters should all have default values of 1 Move() function is used to change the Basex and Basey values of the class shape. (These values will be received as parameter from the main() function). Setsides() function is used to change the length and width of rectangle object. (These values will be received as parameter from the main() function). Note : All get...() functions are used to return corresponding data member values to the main() All set...() functions are used to set the corresponding data member value to the value of the parameter received from the main() Assume above class definitions are stored in "shape.h" file. Then write a main() function to dio the following: Create a circle object with radius 6. Move the center of the circle to points x=2, y=7; Display the x and y coordinate of this circle object. Change the radius of this circle object to 9. Display the area of this circle object using GetRadius() function. (Circle area = 3.14 x radius x radius) Display the circumference of this object using GetRadius() function. (Circumference - 2x 3.14 x radius) Create a rectangle object with length 3 and width 7. Display the x and y coordinate of this rectangle object. Change the length and width to 10 and 15. Display the area of this rectangle object using Getlength() and GetWidth() functions. (RectangleArea-length x width)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