Question: I need c + + code answer for the whole Q Description: Apply what you have learned in OOP, Inheritance, Polymorphism and Files I /

I need c++ code answer for the whole Q
Description: Apply what you have learned in OOP, Inheritance, Polymorphism and Files I/O techniques to build the above shown Shape hierarchy. For all classes we need to store the following information:
All shapes (2D and 3D) must use overloaded comparison operators functions to compare if any object is less, greater, or equal to other objects of the same type in terms of area, perimeter, surfaceArea, volume attribute values,
readData(), print(), printToFile(ofstream &output), readFromFile(ifstream &input) functions must be implemented in all classes (base and derived), taking into consideration they will be used for polymorphism,
computeArea() and computePerimeter() functions must be implemented in all 2 D shape classes (including their base class), taking into consideration their use in polymorphism, computeSurfaceArea() and computeVolume() functions must be implemented in all 3D shape classes (including their base class), taking into consideration their use in polymorphism,
We need to store the information shown in the below table:
\table[[Class,Attributes,Type],[Shape,color, name,array of 10 characters],[Shape2D,area, perimeter,double],[Shape3D,surfaceArea, volume,double],[Circle,radius,double],[Square,side,double],[Triangle,base, height,double],[Hexagon,side,double],[Sphere,radius,double],[Cube,side,double],[Cylinder,radius, height,double],[Cone,radius, height,double]]
You need to find out the equations to compute area, perimeter, surfaceArea and volume attributes on your own.
Requirements
For every class, you need to build a parametrized constructor with default values,
2. readData() function is used to read all the object's data members from the user,
3. print() function is used to print all object's data to the screen,
Your program must be able to write all objects' data to the binary file "Shapes.dat", using the printToFile functions,
Your program should be able to read and append to the "Shapes.dat" file as needed, using the readFromFile functions,
6. Build a main function to (store/retrieve) data (to/from)(output/input) files depending on the user's choice,
7. It is not known how many objects will be added or their order of addition (use dynamic allocation).
Teamwork
I need c + + code answer for the whole Q

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 Programming Questions!