From 3432421eb2c56e91a094df9e2ee5e410b41c395f Mon Sep 17 00:00:00 2001 From: avspo Date: Wed, 28 Oct 2026 13:30:26 -0400 Subject: [PATCH] Fix pyramid surface area validation messages --- src/main/java/com/thealgorithms/maths/Area.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/thealgorithms/maths/Area.java b/src/main/java/com/thealgorithms/maths/Area.java index 84fc67159379..874171518e93 100644 --- a/src/main/java/com/thealgorithms/maths/Area.java +++ b/src/main/java/com/thealgorithms/maths/Area.java @@ -4,6 +4,7 @@ * Find the area of various geometric shapes */ public final class Area { + private Area() { } @@ -69,7 +70,7 @@ public static double surfaceAreaSphere(final double radius) { return 4 * Math.PI * radius * radius; } - /** + /** * Calculate the surface area of a pyramid with a square base. * * @param sideLength side length of the square base @@ -78,16 +79,15 @@ public static double surfaceAreaSphere(final double radius) { */ public static double surfaceAreaPyramid(final double sideLength, final double slantHeight) { if (sideLength <= 0) { - throw new IllegalArgumentException(""); + throw new IllegalArgumentException("Must be a positive sideLength"); } if (slantHeight <= 0) { - throw new IllegalArgumentException("slant height must be greater than 0"); + throw new IllegalArgumentException("Must be a positive slantHeight"); } double baseArea = sideLength * sideLength; double lateralSurfaceArea = 2 * sideLength * slantHeight; return baseArea + lateralSurfaceArea; } - /** * Calculate the area of a rectangle. *