Question: Code in C++ - Read all instructions: Sample output: As shown in the attachment, please implement a base class 'Shape' and two derived classes 'TwoDimensionalShape

Code in C++ - Read all instructions:

Code in C++ - Read all instructions: Sample output: As shown in

Sample output:

the attachment, please implement a base class 'Shape' and two derived classes

As shown in the attachment, please implement a base class 'Shape' and two derived classes 'TwoDimensionalShape and 'ThreeDimensionalShape'. The class "TwoDimensionalShape' should have two derived classes 'Circle' and Triangle' and the class ThreeDimensionalShape' should have two derived classes 'Sphere' and Tetrahedron. You can assume that only regular tetrahedrons will be used. You can also assume that the triangles are equilateral. Each of the two-dimensional shapes (Circle and Triangle) should contain a member function getArea to calculate the area of the two-dimensional shape. Each three-dimensional shape (Sphere and Tetrahedron) should have member functions getArea and getVolume to calculate the surface area and volume of three-dimensional shapes respectively. Write a program to test this implementation. If the shape is two dimensional, its area should be displayed. If the shape is a three-dimensional shape, display its surface area and volume. The instances of the objects should be able to access functions to set and get the center of the shapes. The functions for the 2D shapes should be able to handle 2D coordinates (x.y) while the functions for the 3D shapes should be able to handle 3D coordinates (x.y,.z). Please also implement a print function to print the appropriate information to the screen Please implement this in a way that efficiently uses INHERITANCE. For this and all future assignments that use classes, please use separate files for the classes (header and.cpp files) and main function Please make sure to zip up the whole project directory

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!