A Rectangle Class

The Rectangle class will maintain and work with information for a rectangle.

You must also create a RectangleTest.java interface to test out your class.

 

A Circle Class

Design and implement a class to represent a geometric Circle, and then test your class definition by implementing a main() method that creates Circle instances and displays their circumferences and areas. Your program should produce the following output on the screen:

       
The radius of the circle is 10.0
The diameter of the circle is 20.0
The area of the circle is 314.0
The circumference of the circle is 62.80
The center coordinates of the circle are (1,-2)
The equation of the circle is (x-1)^2 + (y+2)^2 = 100.0
 

The Circle class must contain the following instance variables

q       radius,

q       centerX

q       centerY

 

The Circle class must contain the following instance variables

o    Circle(): sets the values of radius, centerX and centerY to zero.

o    Circle(int r, int x, int y): sets the values of radius to r, the value of centerX to x and the value of centerY to y.

o    Circle(Circle c): sets the values of radius to c.radius, centerX to c.centerX and centerY to c.centerY.

 

The Circle Class must have the following methods:

 

q       setRadius()

q       setCenterX()

q       setCenterY()

q       getRadius()

q       getCenterX()

q       getCenterY()

q       getArea()

q       getCircumference()

q       toString() – outputs radius and center

q       toStringEQ – outputs the equation of the circle