HW2: Shapes

In this homework, you are going to create a bunch of classes related to geometric shapes.

MyShape.java

MyShape represents a shape with a center point, a color to draw the shape, and a font used to displace the name. You shouldn't extend any class in MyShape.java.
Here are all the members and constructors. You can't add any extra members or constructors to it.

How to check if you have all the methods I asked for?

After you compile, use
javap -private MyShape
You can replace MyShape by other class names.
The command shows up all your members and constructor in the class. If you get a line static {} , ignore it.

MyRectangle.java

It extends MyShape. Here are all the members and constructors. You can't add any extra members or constructors to it.

MyCircle.java

It extends MyShape. Here are all the members and constructors. You can't add any extra members or constructors to it.

ShapeTest.java

An easy way to write thie program is to extend JFrame.
When you run java ShapeTest, a frame will shows up with

Grading

The homework will be graded through the following steps

Submit

You should submit 4 files MyShape.java, MyCircle.java, MyRectangle.java, ShapeTest.java in the submit folder.
All source code submitted must contain the following information at the beginning of each file:

    * Your full name.
    * Your student ID number.
    * Your PIC login ID.
    * Your e-mail address.
    * Your discussion section number and TA's name.
    * The assignment number and description.
    * Honesty pledge.

Properly formatted, this information should appear as follows:

/*
 * Name:		Charles Li
 * Student ID:		000 000 000
 * PIC ID:		ccli
 * E-mail:		ccli@math.ucla.edu
 * Discussion:		1A, Mike Moore
 * Assignment:		hw2
 *
 * I, Charles Li, pledge that this is my own independent work, which 
 * conforms to the guidelines of academic honesty as described in the course 
 * syllabus. 
 *
 */

Solution

MyShape.java, MyCircle.java, MyRectangle.java ShapeTest.java .