Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

  • 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

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)

Extra Credit Points (5 - 15 points) :

1) 5 points extra credit:

Note that the current implementation requires only one line type ( '*' in my example) .

For this 5 point extra credit, your program would support two line types, one for horizontal drawing and the other for vertical drawing. For example of rectangle, '_' (underscore) for horizontal line and '|' (bar) for vertical line, and for a circle, a delimiter, (), {}, [], and the inside character.

2) 10 points extra credit. (Let me know if you need an extra weekend for implementing this one)

Extend your code to support drawing multiple objects horizontally. For example, 808

image text in transcribed

Hmmm,... How would you do it? I am thinking about using 2 dimensional array of characters (80 x 25) (or an array of string object) and store the drawing (strings) in the array first then dump the array to the display.

Extra Credit Deliverable:

  • code and output showing the result,

PLEASE READ THE INSTRUCTIONS CLEARLY!!! DO THE EXTRA CREDIT IF YOU WANT TO, BUT IT'S NOT NECESSARY!! IN TOTAL THERE HAS TO BE AT LEAST 13 FILES(6 HEADER AND 6 CPP FILES FOR EACH SHAPE AS WELL AS MAIN DRIVER))!!! PLEASE TRY TO ANSWER THIS PROBLEM ASAP, I REALLY NEED HELP!!! I WILL FOR SURE UPVOTE TO WHOEVER ANSWERS IT!!!

THIS IS ALL OF THE INFORMATION!!! PLEASE ANSWER IT AS SOON AS YOU CAN!!!!

THERE ISN'T A IMAGE MISSING!!! ALL INFORMATION AND PHOTOS ARE HERE!!!!

IT HAS TO BE IN C++!!!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions

Question

What are organization expenses? Provide a couple of examples.

Answered: 1 week ago

Question

denigration of emotional outbursts; being reserved;

Answered: 1 week ago