package advance; abstract class Shop { double Area; public abstract void getArea(); } class Circle extends Shop { private double r; final double PI = 3.14; public void setR(double r) { this.r = r; } public double getR() { return r; } public Circle(double r) { this.r=r; } public void getArea() { super.Area=r*r*PI; } @Override public String toString() { return "Circle{" + "Area=" + Area + ", r=" + r + ", PI=" + PI + '}'; } } class Rectangle extends Shop { private double x; private double y; public void setX(double x) { this.x = x; } public void setY(double y) { this.y = y; } public double getX() { return x; } public double getY() { return y; } public Rectangle(double x, double y) { this.y=y; this.x=x; } public void getArea() { super.Area=x*y; } @Override public String toString() { return "Rectangle{" + "Area=" + Area + ", x=" + x + ", y=" + y + '}'; } } public class Homework2 { public static void main(String[] args) { Circle circle = new Circle(5); Rectangle rectangle = new Rectangle(6, 5); circle.getArea(); rectangle.getArea(); System.out.println(circle.toString()); System.out.println(rectangle.toString()); } }