Question: In this program assignment, you are requested to implement following shapes using structures and classes: Shape type Attributes Methods Relationship comments Point Integer type: x-coordinate,

In this program assignment, you are requested to implement following shapes using structures and classes:

Shape type Attributes Methods Relationship comments
Point

Integer type:

x-coordinate, y-coordinate

None Both (x, y) coordinate attributes are publicly accessible
Shape

Point: reference point

Double: area, circumference

Char: line type (*, _, +, =, ...)

  • Getters and setters of attributes
  • computeArea()
  • computeCircumference()
  • moveBy (anInt)
  • draw()
  • draw (length)
  • draw (wd, ht)
  • setLineType(aChar)
Base class Abstract class
Rectangle

Integers: width, height

char: lineType

  • Implements the methods from Shape
  • Add setHeight(anInt), setBase(anInt)
Inherits from Shape
Square None
  • Inherits methods from Rectangle
  • Add setSide(anInt)
Inherits from Rectangle
Triangle Integers: base, height
  • Implements the methods from Shape
  • Add setHeight(anInt), setBase(anInt)
Inherits from Shape The shape of the triangle will be determined by the sizes of base and height
Circle Integer: radius
  • Implements the methods from Shape
  • Add setRadius(anInt)
Inherits from Shape
  • if radius> 2: draw(length) draws a circle with "(" radius spaces ")"
  • if radius < 3: draw an alphabet "O"

In your test driver program, the following should be demonstrated:

  • Draw similar to the following shapes of your own sizes.
 O * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * (* * * * )(* * * *) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **
  • Display the area and circumference of each shape of the picture above
  • Total area and circumference of all shapes in the picture

NOTE;

  1. No user interaction is needed. You can instantiate the shape objects necessary to draw in your main() function.
  2. Yes, because of the text based terminal characteristics, the unit size of actual vertical and horizontal lines might be different. You may need to adjust the size to make your drawing look better.
  3. Since each object can access its own private member variables, draw() is the only member function we need but let's keep other such as draw( int) or draw (int, int) interfaces and implement them
  4. Circle will use '(' and ')' as a given set of delimiters and the line type of circle is what's going inside the delimiter.
  5. moveBy(int) method updates the reference point (origin) horizontally. A positive value move it to the right and negative value to the left.

Deliverable:

  • A separate .h and .cpp files for each shape class (total at least 13 files, 6 .h + 6.cpp + main driver) in a zip file and plain old text file format
  • A makefile
  • Output in a text file format (no .jpg picture will be accepted)

PLEASE READ THE ASSIGNMENT CLEARLY!!!! THERE HAS TO BE A HEADER AND CPP FILE FOR EACH SHAPE INCLUDING MAIN DRIVER THUS IN TOTAL OF 13 FILES!!! MAKE SURE TO READ THE TABLE OF ATTRIBUTES, METHODS, AND COMMENTS IN THE TABLE!! WHOEVER ANSWERS THANK YOU AND I WILL UPVOTE!!!!

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