@@ -10,17 +10,17 @@ private Area() {
1010 /**
1111 * String of IllegalArgumentException for radius
1212 */
13- private static final String POSITIVE_RADIUS = "Must be a positive radius " ;
13+ private static final String POSITIVE_RADIUS = "Radius must be greater than 0 " ;
1414
1515 /**
1616 * String of IllegalArgumentException for height
1717 */
18- private static final String POSITIVE_HEIGHT = "Must be a positive height " ;
18+ private static final String POSITIVE_HEIGHT = "Height must be greater than 0 " ;
1919
2020 /**
2121 * String of IllegalArgumentException for base
2222 */
23- private static final String POSITIVE_BASE = "Must be a positive base " ;
23+ private static final String POSITIVE_BASE = "Base must be greater than 0 " ;
2424
2525 /**
2626 * Calculate the surface area of a cube.
@@ -30,7 +30,7 @@ private Area() {
3030 */
3131 public static double surfaceAreaCube (final double sideLength ) {
3232 if (sideLength <= 0 ) {
33- throw new IllegalArgumentException ("Must be a positive sideLength " );
33+ throw new IllegalArgumentException ("Side length must be greater than 0 " );
3434 }
3535 return 6 * sideLength * sideLength ;
3636 }
@@ -57,10 +57,10 @@ public static double surfaceAreaSphere(final double radius) {
5757 */
5858 public static double surfaceAreaPyramid (final double sideLength , final double slantHeight ) {
5959 if (sideLength <= 0 ) {
60- throw new IllegalArgumentException ("Must be a positive sideLength " );
60+ throw new IllegalArgumentException ("" );
6161 }
6262 if (slantHeight <= 0 ) {
63- throw new IllegalArgumentException ("Must be a positive slantHeight " );
63+ throw new IllegalArgumentException ("slant height must be greater than 0 " );
6464 }
6565 double baseArea = sideLength * sideLength ;
6666 double lateralSurfaceArea = 2 * sideLength * slantHeight ;
@@ -76,10 +76,10 @@ public static double surfaceAreaPyramid(final double sideLength, final double sl
7676 */
7777 public static double surfaceAreaRectangle (final double length , final double width ) {
7878 if (length <= 0 ) {
79- throw new IllegalArgumentException ("Must be a positive length " );
79+ throw new IllegalArgumentException ("Length must be greater than 0 " );
8080 }
8181 if (width <= 0 ) {
82- throw new IllegalArgumentException ("Must be a positive width " );
82+ throw new IllegalArgumentException ("Width must be greater than 0 " );
8383 }
8484 return length * width ;
8585 }
@@ -109,7 +109,7 @@ public static double surfaceAreaCylinder(final double radius, final double heigh
109109 */
110110 public static double surfaceAreaSquare (final double sideLength ) {
111111 if (sideLength <= 0 ) {
112- throw new IllegalArgumentException ("Must be a positive sideLength " );
112+ throw new IllegalArgumentException ("Side Length must be greater than 0 " );
113113 }
114114 return sideLength * sideLength ;
115115 }
@@ -121,7 +121,7 @@ public static double surfaceAreaSquare(final double sideLength) {
121121 * @param height height of triangle
122122 * @return area of given triangle
123123 */
124- public static double surfaceAreaTriangle (final double base , final double height ) {
124+ public static double surfaceAreaTriangle (final double baseLength , final double height ) {
125125 if (base <= 0 ) {
126126 throw new IllegalArgumentException (POSITIVE_BASE );
127127 }
0 commit comments