This website is preserved for historical and scholarly reference and is no longer actively maintained.
CpSc 210, Section 1
Assignment 5
13 June 2000
Due: Tuesday, June 13 at midnight
Late penalties: 20 points per partial day late. That is, programs
turned in after midnight Tuesday and before midnight Wednesday
will have 20 points deducted for late, programs turned in after
midnight Wednesday and before midnight Thursday will have a total
of 40 points deducted for late, etc.
Total point value of assignment: 100 points
Late submissions not accepted after: Friday, June 16 at midnight
This assignment is to be done INDIVIDUALLY.
Create a directory, A5, which will contain all parts of this assignment.
The directory will contain a class named Ngon.java. Ngon.java should
have a "public static void main (String [] args)" method which you
use to test your code.
The objectives of this program are to give you some experience writing
an entire class and implementing an interface.
You are to construct an Ngon class, which implements the Drawable
interface found on pages 311-312 of Java Elements. You will have
compiler errors unless all methods in the interface are present,
but these may be represented by stubs during development.
You should have the following constructors:
public Ngon(int n)
// post: constructs a regular polygon with n sides
// Let 100 be the (arbitrary) radius of the polygon
public Ngon (Ngon other)
// post: generates a copy of other (i.e., copy constructor)
public Ngon (int n, int radius)
// post: constructs a polygon with n sides and radius radius
public Ngon (Pt [] args)
// post: constructs a polygon from the array of points
Input:
None required, but your main method may input values if
you wish.
Output:
Print your name, the assignment number, and a short description
of the assignment to the screen.
Your main method should write appropriate messages to the
screen to indicate methods being tested.
Other requirements:
Follow the style standards to be found on your instructor's
web page for CPSC 210.
Submit your program using the handin command. There is a link to
the handin description on your lab page (www.cs.clemson.edu/~lab210).
Grading rubric:
Required documentation and style standards: 10 pts.
The program compiles without error (and must include the
statement "implements Drawable" in class declaration. 10 pts.
Program must compile for further points to be awarded.
(Max points for programs that don't compile: 10)
Constructors: 5 pts. each = 20 pts.
Methods: height, width, left, right, bottom, top, two
center methods (5 pts each = 40 pts.)
Methods: drawOn, clearOn (5 pts. each = 10 pts.)
Method: fillOn (10 pts.)
Quality of test program: 10 pts.
Note: The sum of the above points is 110.