COSC220 Project Assignment #1: Shape Fun solution

$29.99

Original Work ?

Download Details:

  • Name: project1-zdkush.zip
  • Type: zip
  • Size: 212.79 KB

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

Description

5/5 - (3 votes)

Description: This program will ask user to input a shape (circle, rectangle, or square). Then it
will ask user to enter the characters of the shape (eg. center, length, width, side, or radius). If the
shape is located in a surface with a coordinate system center (0,0) and 20 unites x axis, and 10
unites of y-axis, the program will output the center position and the area of the shape. If the
shape is not located in the surface, then the program will check if the shape can be relocated (i.e.
move the center to a new position) to fit into the surface. If yes, it will display the new center
position and the area of the shape. Otherwise, it will display the error message.
Specifications:
x Your program must implement a base class called Shape. The shape class has a member
of the center. The shape class has a member function to move the center of the shape.
The shape class has a virtual function to display the center and area of the shape. The
shape class has two pure virtual functions, one to calculate the area of the shape and the
other to check if the shape can be fitted into the surface.
x Your program must implement a class called Rectangle, which is derived from the Shape
class and has members of length and width.
x Your program must implement a class called Circle, which is derived from the Shape
class and has a member of radius.
x Your program must implement a class called Square, which is derived from the Rectangle
class and has a member of side
x Your program must implement a class called Center, which contains two data members,
the x-coordinate and y-coordinate of the center.
x Your program must implement object composition by including an object of Center class
in the Shape class.
x Each class must implement a default constructor and a non-default constructor
x Your program must implement an error handler to catch the shape that cannot be fitted
into the 20×10 surface using C++ exceptions.
x Your program must implement operator overloading to display the center object
x You must write/organize your program based on Course Coding Style Requirements
(click the style manual for the detail)
Requirements for Submission:
You must hand in
1. design/pseudocode/hierarchy chart. of your algorithm.
2. a printed copy of your source code.
3. your set of sample screen outputs.
4. you submit a copy of your source code through myClasses@SU. You store your program
in computer science department Linux machines and demo your program to the instructor
upon request.
5. Program report: state clearly how to compile and execute your program. If your program
doesn’t work well, what’s the problem? Cite all your reference/help, for example, you get
the help from other students/SI or point out Internet reference resource sites. You can not
copy others’ work. It is an individual program assignment!
Grading Rubric:
Algorithm design/Pseudocode 5
Workable Program 25
Correct output 20
Required features (ADTs, object composition, error handling, operator overloading,
inheritance) 40
Comments/readability/style of program 10
Extra credits: The program can draw the shapes with correct positions in the given surface on
screen 15