/
Vini1979
/
Java_OOP
Обзор
Документация
Войти
/
Vini1979
/
Java_OOP
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
Lecture_05/Ex003Math/Mathematics/Shapes/Circle.java
38 строк
847 B
Evgeny
Added Seminar_05
11 апр 2023, 23:42
11 апр 2023, 23:42
057a1aa
Код
Авторство
О чём код?
package Ex003Math.Mathematics.Shapes; import Ex003Math.Mathematics.Exceptions.UnacceptableValueException; public class Circle extends Shape { public static Circle create(double radius, String name) throws UnacceptableValueException { // ???... if (radius < 0) throw new UnacceptableValueException("radius < 0"); var instance = new Circle(); instance.name = name; instance.radius = radius; return instance; } public double radius; private Circle() { } public double getRadius() { return radius; } @Override public double getArea() { return Math.pow(radius, 2) * Math.PI; } // @Override // public String toString() { // // ???... // return String.format("Name: %s radius: %s", name, radius); // } }