Skip to content

Commit 8f900a2

Browse files
committed
Added surface area calculation for pyramid
1 parent 2319794 commit 8f900a2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • src/main/java/com/thealgorithms/maths

‎src/main/java/com/thealgorithms/maths/Area.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ public static double surfaceAreaSphere(final double radius) {
7878
*/
7979
public static double surfaceAreaPyramid(final double sideLength, final double slantHeight) {
8080
if (sideLength <= 0) {
81-
throw new IllegalArgumentException("");
81+
throw new IllegalArgumentException("Must be a positive sideLength");
8282
}
8383
if (slantHeight <= 0) {
84-
throw new IllegalArgumentException("slant height must be greater than 0");
84+
throw new IllegalArgumentException("Must be a positive slantHeight");
8585
}
8686
double baseArea = sideLength * sideLength;
8787
double lateralSurfaceArea = 2 * sideLength * slantHeight;
@@ -232,4 +232,4 @@ public static double surfaceAreaCone(final double radius, final double height) {
232232
}
233233
return Math.PI * radius * (radius + Math.pow(height * height + radius * radius, 0.5));
234234
}
235-
}
235+
}

0 commit comments

Comments
 (0)