Page 282 - 6253
P. 282

this.side = side;
                }

                public double getSide() {
                    return side;
                }

                public void setSide(double side) {
                    this.side = side;
                }

                @Override
                public double getArea() {
                    return side * side;
                }

                @Override
                public double getPerimeter() {
                    return 4 * side;
                }

                @Override
                public int getNumberOfVertex() {
                    return 4;
                }

                @Override
                public void shapeInfo() {
                    System.out.println("This is a shape 'Square':");
                    super.shapeInfo();
                    System.out.println("\tside = " + side);
                }
            }

            /**
             * Created by Mykola Demchyna on 24.03.2018.
             */

            public class Circle extends Shape implements IPerimeter {

                private double radius;

                public Circle(double radius, String color, Border borderStyle) {
                    super(color, borderStyle);
                    this.radius = radius;
                }

                public double getRadius() {
                    return radius;
                }

                public void setRadius(double radius) {
                    this.radius = radius;
                }

                @Override
                public double getArea() {
                    return Shape.PI * radius * radius;
                }

                @Override
                public double getPerimeter() {
                    return 2 * Shape.PI * radius;
                }

                @Override


                                                              281
   277   278   279   280   281   282   283   284   285