Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ 3. Consider the classes described below: Class Shape Circle Rectangle Data Members Basex Basex Basex Basey Base Y Basey Radius Length Width Methods Shape()

image text in transcribed

C++

3. Consider the classes described below: Class Shape Circle Rectangle Data Members Basex Basex Basex Basey Base Y Basey Radius Length Width Methods Shape() Circle() Rectangle() (Function Members) Getx() GetX() Getx() GetY() GetY() GetY() Movel) Movel) Move() 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 = 2 x 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions