Solved 24-780 Engineering Computation Problem Set 12

$30.00

Original Work ?

Download Details:

  • Name: Assignment-12-lmlsz3.zip
  • Type: zip
  • Size: 208.52 KB

Category: Tags: , You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

Rate this product

PS12
Download ps12.cpp. This program cannot compiled as is. First you need to make a class hierarchy such
that:
PrimitiveWithTwoPoints is a kind of Primitive.
PrimitiveWithPointAndRadius is a kind of Primitive.
Line is a kind of PrimitiveWithTwoPoints.
Box is a kind of PrimitiveWithTwoPoints.
Circle is a kind of PrimitiveWithPointAndRadius.
Make sure you can compile it.
The program is a very simple graphic-drawing tool. You first click two points, and then press L for
inserting a line, B for a box, and C for a circle. Use virtual and override keywords so that primitives are
drawn correctly.
Also use const qualifier where appropriate for full credit.
5 point bonus: Let each primitive have its own color (r,g,b). Since every primitive has its own color,
member variable r,g,b must be in the base class. When the user presses 1 before pressing L, B, or C,
the next primitive color must be blue (0,0,1), 2 for red (1,0,0), 3 for purple (1,0,1), 4 for green (0,1,0), 5
for cyan (0,1,1), 6 for yellow (1,1,0), and 7 for black (0,0,0). Also the dots showing where the user
clicked must be drawn in the color of the next primitive so that the user can see what color primitive
will be inserted next.
Test your code with one of the compiler servers and make sure you do not get a red line from the
server. Also, your code may run fine on your environment, but that does not mean it runs ok on the
grading environment. Be careful about runtime errors. Double check your program does not access
outside of the range of the array, one glEnd() for glBegin(), do not delete a pointer that is not assigned
a memory block, etc. Make sure you are not using an uninitialized variable.