Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- public class Circle extends Rectangle {
- public int radius;
- public Circle() {
- super(6, 6, 0, Color.CYAN);
- radius = 3;
- }
- public Circle(int radius, int length, Color color) {
- super((2*radius), (2*radius), 0, color);
- this.radius = radius;
- }
- public Circle(int newX, int newY, int newRadius) {
- super(newX, newY, 0, 0);
- radius = newRadius;
- }
- public int getRadius() {
- return radius;
- }
- public void setRadius(int radius) {
- this.radius = radius;
- }
- public int calcArea() {
- return (int) Math.ceil(3.14 * radius * radius);
- }
- public DrawFigure drawFigure() {
- DrawFigure circle1 = new DrawFigure(3, radius, 0);
- return circle1;
- }
- public String toString() {
- return "Radius = " + radius + " \n" + super.toString();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement