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 (*, _, +, =, ...) |
| Base class | Abstract class |
Rectangle | Integers: width, height |
| Inherits from Shape | |
Square | None |
| Inherits from Rectangle | |
Triangle | Integers: base, height |
| Inherits from Shape | The shape of the triangle will be determined by the sizes of base and height |
Circle | Integer: radius |
| Inherits from Shape |
|
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;
- No user interaction is needed. You can instantiate the shape objects necessary to draw in your main() function.
- 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.
- 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
- Circle will use '(' and ')' as a given set of delimiters and the line type of circle is what's going inside the delimiter.
- 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
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!!!!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started