/
EugenyCh7
/
JavaAndScalaLessons
Обзор
Документация
Войти
/
EugenyCh7
/
JavaAndScalaLessons
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
JavaTest/src/ch4/ex5/Rectangle.java
35 строк
720 B
Eugeny Chekmarev
IDEA update
15 июн 2021, 21:11
15 июн 2021, 21:11
47fadf9
Код
Авторство
О чём код?
package ch4.ex5; import ch4.ex3.Point; public class Rectangle extends Shape { private final double width; private final double height; public Rectangle(Point topLeft, double width, double height) { super(topLeft); this.width = width; this.height = height; } @Override public Point getCenter() { return new Point( getOrigin().getX() + width * 0.5, getOrigin().getY() + height * 0.5 ); } public double getWidth() { return width; } public double getHeight() { return height; } @Override public Shape clone() { return new Rectangle(getOrigin(), width, height); } }