Page 1 of 1

Make a object-oriented program to print position of vertices for 3 different figures. (1) class Point is declared as b

Posted: Sat May 14, 2022 3:39 pm
by answerhappygod
Make a object-oriented program to print position of vertices for 3 different figures.
(1) class Point is declared as below:
Make A Object Oriented Program To Print Position Of Vertices For 3 Different Figures 1 Class Point Is Declared As B 1
Make A Object Oriented Program To Print Position Of Vertices For 3 Different Figures 1 Class Point Is Declared As B 1 (78.13 KiB) Viewed 59 times
(2) class Object3d is declared as:
Make A Object Oriented Program To Print Position Of Vertices For 3 Different Figures 1 Class Point Is Declared As B 2
Make A Object Oriented Program To Print Position Of Vertices For 3 Different Figures 1 Class Point Is Declared As B 2 (93.02 KiB) Viewed 59 times
(3)Example running result is shown as below:
Make A Object Oriented Program To Print Position Of Vertices For 3 Different Figures 1 Class Point Is Declared As B 3
Make A Object Oriented Program To Print Position Of Vertices For 3 Different Figures 1 Class Point Is Declared As B 3 (16.61 KiB) Viewed 59 times
(4) Please finish Object3d.cpp and main function. Run the program and capture screenshots of output.
class Point{ private: double x,y,z; public: Point(){x=0.0;y=0.0;2=0.0; } init(double xx, double yy, double zz){ X=XX; y=yy; z=ZZ; } void print(){ cout<<"("<<x<<","<<y<<","<<z«<")"<<endl; } double getX() { return x; } double getY(){ return y;} double getz(){ return z; } };

class Object3d { private: Point *aPtr; int nvertices;//quad=4||pyramid=5|/cube=8; int figure;//1-quad|/2-pyramid/|3-cube; public: Object3d(Object3d &); Object3d(int type);//1-quadſ/2-pyramid||3-cube; Object3d() { if (nvertices > 0) delete [] aptr; } void print();

Please create data for a 3D shape: 1: Quad (2 units in the edge, centerd in origin on XY plane.) 2: Pyramd (2 units in the edge and height, centerd in origin of 3D space.) 3: Cube (2 units in the edge, centerd in origin of 3D space.) 1 The 3D object has 4 vertices: (x, y, z) (-1, -1,0) (1,-1,0) (1, 1, 0) (-1, 1, 0)