Question: For each of the following classes -create default constructor and parameterized constructors(calling parent(s) parameterized constructors where it applies -Add accessor and mutator function for the

For each of the following classes

-create default constructor and parameterized constructors(calling parent(s) parameterized constructors where it applies

-Add accessor and mutator function for the attribute inherit to the class

Create a Base class called Shape2d

-with the protected floating point attribute area

-operator overload the + & - and operations to return the float respective to the area

Derive from the a Base class from called Shape2d called Rectangle

-with the additional floating point attributes length & width

Derive from the a Base class from called Shape2d called Circle

-with the additional floating point attributes radius

Create the Base class called Shape3d

-with the protected floating point attribute volume

-operator overload the *(have it add) & /(have it subtract) and operations to return the float respective to the volume

Derive from both Rectangle and Shape3d a class called Box

-with the additional floating point attributes height

Derive from both Circle and Shape3d a class called Cylinder

-with the additional floating point attributes height

For each of following classes [Circle, Rectangle, Box & Cylinder] create 3 instances each (using the parameterized constructor {no interactive input required}

Demonstrate the + & - operation overloading using the following combinations

Circle + Circle Rectangle + Rectangle Rectangle + Circle Circle - Circle Rectangle - Rectangle Rectangle - Circle Box + Box Rectangle + Box Box + Circle Box - Circle Rectangle - Box Box - Circle Cylinder + Cylinder Rectangle + Cylinder Cylinder + Circle Cylinder - Circle Rectangle - Cylinder Rectangle - Cylinder

Demonstrate the * & / operation overloading using the following combinations

Box * Box Cylinder * Cylinder Box * Cylinder Box / Box Cylinder / Cylinder Box / Cylinder

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!