Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement a graphics System that has classes for various figures: rectangles, sq

ID: 3557353 • Letter: I

Question

Implement a graphics System that has classes for various figures: rectangles, squares, triangles and circles. A rectangle has data members height, width, color , and center point. A square has center point and an edge and color . A circle has data members center, color and radius. The several specific shape classes are derived from a common class, Figure.

Implement classes Rectangle, Square, Triangle and Circle classes and derive them from class Figure.

In addition to constructor, destructor and set/get functions, each class has two virtual functions erase and draw to draw or erase the shape.

To draw or erase a figure you must use OpenGL graphics library.

TO RECEIVE FULL CREDIT PLEASE SHOW SCREENSHOTS
Please zip the folder of the whole assignment.

Explanation / Answer

SHAPE CLASS :::(shape.h)

Shape Implementation (Shape.cpp)

Rectangle Class (Rectangle.h)

Rectangle Implementation (Rectangle.cpp)

Circle Interface (Circle.h)

Circle Implementation (Circle.cpp)

From the above code : you would get a pretty good idea of what to do !!

  #include "Shape.h"  #include "Circle.h"  #include <iostream.h>    // constructor  Circle::Circle(int newx, int newy, int newradius): Shape(newx, newy) {     setRadius(newradius);  }    // accessors for the radius  int Circle::getRadius() { return radius; }  void Circle::setRadius(int newradius) { radius = newradius; }    // draw the circle  void Circle::draw() {    cout << "Drawing a Circle at:(" << getX() << "," << getY() <<        "), radius " << getRadius() << endl;  }  

From the above code : you would get a pretty good idea of what to do !!

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote