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 IO techniques to build the above shown Shape hierarchy. For all classes we need to store the following information:
All shapes D and D 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 printToFileofstream &output readFromFileifstream &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 D shape classes including their base class taking into consideration their use in polymorphism, computeSurfaceArea and computeVolume functions must be implemented in all D shape classes including their base class taking into consideration their use in polymorphism,
We need to store the information shown in the below table:
tableClassAttributes,TypeShapecolor, name,array of charactersShapeDarea, perimeter,doubleShapeDsurfaceArea, volume,doubleCircleradius,doubleSquareside,doubleTrianglebase, height,doubleHexagonside,doubleSphereradius,doubleCubeside,doubleCylinderradius, height,doubleConeradius, 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,
readData function is used to read all the object's data members from the user,
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,
Build a main function to storeretrieve data tofromoutputinput files depending on the user's choice,
It is not known how many objects will be added or their order of addition use dynamic allocation
Teamwork
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
