1
0

add javadoc to AreaCalculator

This commit is contained in:
2024-09-05 10:28:32 +03:00
parent f840981eb1
commit af94e99fc9

View File

@@ -1,7 +1,17 @@
package ru.lionarius; package ru.lionarius;
/**
* A class that provides methods to calculate the area of different geometric shapes.
*/
public class AreaCalculator { public class AreaCalculator {
/**
* Calculates the area of a circle given its radius.
*
* @param radius The radius of the circle.
* @return The area of the circle.
* @throws IllegalArgumentException if the radius is negative.
*/
public double circle(double radius) { public double circle(double radius) {
if (radius < 0.0) if (radius < 0.0)
throw new IllegalArgumentException("radius cannot be negative"); throw new IllegalArgumentException("radius cannot be negative");