abstract class Figure {
protected int x;
protected int y;
public static final int Count = 0;
public int getX() {
return x;
}
public int getY() {
return y;
}
public void setX(int x) {
this.x = x;
}
public void setY(int y) {
this.y = y;
}
abstract void draw();
abstract void move();
public static int Count (int a) {
int t=0;
t++;
return t;
}
}
class Line extends Figure
{ int x2;
int y2;
// Scanner scanner = new Scanner(System.in);
// int x1 = scanner.nextInt();
// int y1 = scanner.nextInt();
// int x2 = scanner.nextInt();
// int y2 = scanner.nextInt();
Line(int k1,
int l1,
int k2,
int l2
) { super.x = k1;
super.y = l1;
x2 = k2;
y2 = l2;
}
void draw() {
System.
out.
println("Координаты:"); System.
out.
println("(x1;y1):" + "(" + x
+ ";" + y
+ ")"); System.
out.
println("(x2;y2):" + "(" + x2
+ ";" + y2
+ ")"); }
void move() {
//System.out.println("Сдвинуть фигуру на: ");
// int t = scanner.nextInt();
// x1 = x1 + t;
// x2 = x2 + t;
//System.out.println("Сдвинуть фигуру на: ");
//System.out.println("Сдвинуть фигуру на: ");
//System.out.println("Сдвинуть фигуру на: ");
}
}
int x2;
int y2;
int x3;
int y3;
int x4;
int y4;
super.x = k1;
super.y = l1;
x2 = x;
y2 = l2;
x3 = k3;
y3 = y;
x4 = x3;
y4 = y2;
}
void draw() {
System.
out.
println("Прямоугольник"); System.
out.
println("Координаты:"); System.
out.
println("(x1;y1):" + "(" + x
+ ";" + y
+ ")"); System.
out.
println("(x2;y2):" + "(" + x2
+ ";" + y2
+ ")"); System.
out.
println("(x3;y3):" + "(" + x3
+ ";" + y3
+ ")"); System.
out.
println("(x4;y4):" + "(" + x4
+ ";" + y4
+ ")"); }
void move() {
}
}
class Circle extends Figure {
//Scanner scanner = new Scanner(System.in);
//int x = scanner.nextInt();
//int y = scanner.nextInt();
//int r = scanner.nextInt();
int r;
Circle(int k1, int l1, int u) {
super.x = k1;
super.y = l1;
r = u;
}
void draw() {
System.
out.
println("Координаты:"); System.
out.
println("Центр (x;y):" + "(" + x
+ ";" + y
+ ")"); System.
out.
println("Верхняя точка: " + "(" + x
+ ";" + (y
+ r
) + ")"); System.
out.
println("Левая точка: " + "(" + (x
- r
) + ";" + y
+ ")"); System.
out.
println("Нижняя точка: " + "(" + x
+ ";" + (y
- r
) + ")"); System.
out.
println("Правая точка: " + "(" + (x
+ r
) + ";" + y
+ ")"); }
void move() {
}
}
class CompositeFigure extends Figure {
// public CompositeFigure()
void draw() {
}
void move() {
}
}
class Activity {
public static void main
(String[] args
) { Circle circle = new Circle(0, 0, 2);
line.draw();
rectangle.draw();
circle.draw();
}
}
YWJzdHJhY3QgY2xhc3MgRmlndXJlIHsKICAgIHByb3RlY3RlZCBpbnQgeDsKICAgIHByb3RlY3RlZCBpbnQgeTsKICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IENvdW50ID0gMDsKCiAgICBwdWJsaWMgaW50IGdldFgoKSB7CiAgICAgICAgcmV0dXJuIHg7CiAgICB9CgogICAgcHVibGljIGludCBnZXRZKCkgewogICAgICAgIHJldHVybiB5OwogICAgfQoKICAgIHB1YmxpYyB2b2lkIHNldFgoaW50IHgpIHsKICAgICAgICB0aGlzLnggPSB4OwogICAgfQoKICAgIHB1YmxpYyB2b2lkIHNldFkoaW50IHkpIHsKICAgICAgICB0aGlzLnkgPSB5OwogICAgfQoKICAgIGFic3RyYWN0IHZvaWQgZHJhdygpOwoKICAgIGFic3RyYWN0IHZvaWQgbW92ZSgpOwoKICAgIHB1YmxpYyBzdGF0aWMgaW50IENvdW50IChpbnQgYSkgewogICAgICAgIGludCB0PTA7CiAgICAgICAgdCsrOwogICAgICAgIHJldHVybiB0OwogICAgfQoKfQoKIGNsYXNzIExpbmUgZXh0ZW5kcyBGaWd1cmUgewogICAgIGludCB4MjsKICAgICBpbnQgeTI7CiAgICAgLy8gIFNjYW5uZXIgc2Nhbm5lciA9IG5ldyBTY2FubmVyKFN5c3RlbS5pbik7CgogICAgIC8vICBpbnQgeDEgPSBzY2FubmVyLm5leHRJbnQoKTsKICAgICAvLyAgaW50IHkxID0gc2Nhbm5lci5uZXh0SW50KCk7CiAgICAgLy8gIGludCB4MiA9IHNjYW5uZXIubmV4dEludCgpOwogICAgIC8vICBpbnQgeTIgPSBzY2FubmVyLm5leHRJbnQoKTsKCiAgICAgTGluZShpbnQgazEsIGludCBsMSwgaW50IGsyLCBpbnQgbDIpIHsKICAgICAgICAgc3VwZXIueCA9IGsxOwogICAgICAgICBzdXBlci55ID0gbDE7CiAgICAgICAgIHgyID0gazI7CiAgICAgICAgIHkyID0gbDI7CiAgICAgfQoKICAgICB2b2lkIGRyYXcoKSB7CiAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigi0JvQuNC90LjRjyIpOwogICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oItCa0L7QvtGA0LTQuNC90LDRgtGLOiIpOwogICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIih4MTt5MSk6IiArICIoIiArIHggKyAiOyIgKyB5ICsgIikiKTsKICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCIoeDI7eTIpOiIgKyAiKCIgKyB4MiArICI7IiArIHkyICsgIikiKTsKICAgICB9CgogICAgIHZvaWQgbW92ZSgpIHsKICAgICAgICAgLy9TeXN0ZW0ub3V0LnByaW50bG4oItCh0LTQstC40L3Rg9GC0Ywg0YTQuNCz0YPRgNGDINC90LA6ICIpOwogICAgICAgICAvLyAgICAgICAgaW50IHQgPSBzY2FubmVyLm5leHRJbnQoKTsKICAgICAgICAgLy8gICAgICAgIHgxID0geDEgKyB0OwogICAgICAgICAvLyAgICAgICAgeDIgPSB4MiArIHQ7CiAgICAgICAgIC8vU3lzdGVtLm91dC5wcmludGxuKCLQodC00LLQuNC90YPRgtGMINGE0LjQs9GD0YDRgyDQvdCwOiAiKTsKICAgICAgICAgLy9TeXN0ZW0ub3V0LnByaW50bG4oItCh0LTQstC40L3Rg9GC0Ywg0YTQuNCz0YPRgNGDINC90LA6ICIpOwogICAgICAgICAvL1N5c3RlbS5vdXQucHJpbnRsbigi0KHQtNCy0LjQvdGD0YLRjCDRhNC40LPRg9GA0YMg0L3QsDogIik7CiAgICAgfQogfQogY2xhc3MgUmVjdGFuZ2xlIGV4dGVuZHMgRmlndXJlIHsKCiAgICAgaW50IHgyOwogICAgIGludCB5MjsKICAgICBpbnQgeDM7CiAgICAgaW50IHkzOwogICAgIGludCB4NDsKICAgICBpbnQgeTQ7CgogICAgUmVjdGFuZ2xlKGludCBrMSwgaW50IGwxLCBpbnQgbDIsIGludCBrMykgewogICAgICAgICBzdXBlci54ID0gazE7CiAgICAgICAgIHN1cGVyLnkgPSBsMTsKICAgICAgICAgeDIgPSB4OwogICAgICAgICB5MiA9IGwyOwogICAgICAgICB4MyA9IGszOwogICAgICAgICB5MyA9IHk7CiAgICAgICAgIHg0ID0geDM7CiAgICAgICAgIHk0ID0geTI7CiAgICAgfQoKICAgICB2b2lkIGRyYXcoKSB7CgogICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oItCf0YDRj9C80L7Rg9Cz0L7Qu9GM0L3QuNC6Iik7CiAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigi0JrQvtC+0YDQtNC40L3QsNGC0Ys6Iik7CiAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiKHgxO3kxKToiICsgIigiICsgeCArICI7IiArIHkgKyAiKSIpOwogICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIih4Mjt5Mik6IiArICIoIiArIHgyICsgIjsiICsgeTIgKyAiKSIpOwogICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIih4Mzt5Myk6IiArICIoIiArIHgzICsgIjsiICsgeTMgKyAiKSIpOwogICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIih4NDt5NCk6IiArICIoIiArIHg0ICsgIjsiICsgeTQgKyAiKSIpOwogICAgIH0KCiAgICAgdm9pZCBtb3ZlKCkgewogICAgIH0KIH0KIGNsYXNzIENpcmNsZSBleHRlbmRzIEZpZ3VyZSB7CiAgICAgLy9TY2FubmVyIHNjYW5uZXIgPSBuZXcgU2Nhbm5lcihTeXN0ZW0uaW4pOwogICAgIC8vaW50IHggPSBzY2FubmVyLm5leHRJbnQoKTsKICAgICAvL2ludCB5ID0gc2Nhbm5lci5uZXh0SW50KCk7CiAgICAgLy9pbnQgciA9IHNjYW5uZXIubmV4dEludCgpOwogICAgIGludCByOwoKICAgICBDaXJjbGUoaW50IGsxLCBpbnQgbDEsIGludCB1KSB7CiAgICAgICAgIHN1cGVyLnggPSBrMTsKICAgICAgICAgc3VwZXIueSA9IGwxOwogICAgICAgICByID0gdTsKICAgICB9CgogICAgIHZvaWQgZHJhdygpIHsKCiAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigi0JrRgNGD0LMiKTsKICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCLQmtC+0L7RgNC00LjQvdCw0YLRizoiKTsKICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCLQptC10L3RgtGAICh4O3kpOiIgKyAiKCIgKyB4ICsgIjsiICsgeSArICIpIik7CiAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigi0JLQtdGA0YXQvdGP0Y8g0YLQvtGH0LrQsDogIiArICIoIiArIHggKyAiOyIgKyAoeSArIHIpICsgIikiKTsKICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCLQm9C10LLQsNGPINGC0L7Rh9C60LA6ICIgKyAiKCIgKyAoeCAtIHIpICsgIjsiICsgeSArICIpIik7CiAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigi0J3QuNC20L3Rj9GPINGC0L7Rh9C60LA6ICIgKyAiKCIgKyB4ICsgIjsiICsgKHkgLSByKSArICIpIik7CiAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigi0J/RgNCw0LLQsNGPINGC0L7Rh9C60LA6ICIgKyAiKCIgKyAoeCArIHIpICsgIjsiICsgeSArICIpIik7CiAgICAgfQoKICAgICB2b2lkIG1vdmUoKSB7CiAgICAgfQogfQogY2xhc3MgQ29tcG9zaXRlRmlndXJlIGV4dGVuZHMgRmlndXJlIHsKICAgICAvLyBwdWJsaWMgQ29tcG9zaXRlRmlndXJlKCkKICAgICB2b2lkIGRyYXcoKSB7CiAgICAgfQoKICAgICB2b2lkIG1vdmUoKSB7CiAgICAgfQoKIH0KCiBjbGFzcyBBY3Rpdml0eSB7CiAgICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewogICAgICAgICBMaW5lIGxpbmUgPSBuZXcgTGluZSgxLCAxLCA0LCAyKTsKICAgICAgICAgQ2lyY2xlIGNpcmNsZSA9IG5ldyBDaXJjbGUoMCwgMCwgMik7CiAgICAgICAgIFJlY3RhbmdsZSByZWN0YW5nbGUgPSBuZXcgUmVjdGFuZ2xlKDMsIDMsIDQsIDYpOwoKICAgICAgICAgbGluZS5kcmF3KCk7CiAgICAgICAgIHJlY3RhbmdsZS5kcmF3KCk7CiAgICAgICAgIGNpcmNsZS5kcmF3KCk7CiAgICAgfQp9