In: Computer Science
The assignment will be graded both running and reading your code.
Readability: Your code should be readable. Add
comments wherever is necessary.
If needed, write helper functions to break the code into small,
readable chunks.
Write two concrete classes implementing GeometricShape
The class Circle. Circle will have the following public methods:
// a constructor
Circle(Point center, int radius);
// returns the area of the circle
float getArea();
// returns the perimeter of the circle
float getPerimeter();
// prints the center of the circle and its radius
virtual void print();
The class Rectangle. Rectangle will have the following public methods:
// a constructor
Rectangle(Point topLeftPoint, int length,
int width);
// returns the area of the rectangle
float getArea();
// returns the perimeter of the circle
float getPerimeter();
// prints the top left point of the rectangle, its length
and width
virtual void print();
Write a function test() that tests your solutions.
|
import java.util.*; |