From 8f900a21622c2e63c1e18c4dcd676eba7c4a021b Mon Sep 17 00:00:00 2001 From: ShailenN1 Date: Thu, 29 Oct 2026 11:20:10 -0400 Subject: [PATCH] Added surface area calculation for pyramid --- src/main/java/com/thealgorithms/maths/Area.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/thealgorithms/maths/Area.java b/src/main/java/com/thealgorithms/maths/Area.java index 84fc67159379..ec9c71fb9d36 100644 --- a/src/main/java/com/thealgorithms/maths/Area.java +++ b/src/main/java/com/thealgorithms/maths/Area.java @@ -78,10 +78,10 @@ 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; @@ -232,4 +232,4 @@ public static double surfaceAreaCone(final double radius, final double height) { } return Math.PI * radius * (radius + Math.pow(height * height + radius * radius, 0.5)); } -} +} \ No newline at end of file