Skip to content

Commit f4941f4

Browse files
committed
fix: base changed to baseLength for better understanding
1 parent c720b02 commit f4941f4

File tree

1 file changed

+7
-7
lines changed
  • src/main/java/com/thealgorithms/maths

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public static double surfaceAreaTriangle(final double baseLength, final double h
128128
if (height <= 0) {
129129
throw new IllegalArgumentException(POSITIVE_HEIGHT);
130130
}
131-
return base * height / 2;
131+
return baseLength* height / 2;
132132
}
133133

134134
/**
@@ -138,8 +138,8 @@ public static double surfaceAreaTriangle(final double baseLength, final double h
138138
* @param height height of a parallelogram
139139
* @return area of given parallelogram
140140
*/
141-
public static double surfaceAreaParallelogram(final double base, final double height) {
142-
if (base <= 0) {
141+
public static double surfaceAreaParallelogram(final double baseLength, final double height) {
142+
if (baseLength <= 0) {
143143
throw new IllegalArgumentException(POSITIVE_BASE);
144144
}
145145
if (height <= 0) {
@@ -156,17 +156,17 @@ public static double surfaceAreaParallelogram(final double base, final double he
156156
* @param height height of trapezium
157157
* @return area of given trapezium
158158
*/
159-
public static double surfaceAreaTrapezium(final double base1, final double base2, final double height) {
160-
if (base1 <= 0) {
159+
public static double surfaceAreaTrapezium(final double baseLength1, final double baseLength2, final double height) {
160+
if (baseLength1 <= 0) {
161161
throw new IllegalArgumentException(POSITIVE_BASE + 1);
162162
}
163-
if (base2 <= 0) {
163+
if (baseLength2 <= 0) {
164164
throw new IllegalArgumentException(POSITIVE_BASE + 2);
165165
}
166166
if (height <= 0) {
167167
throw new IllegalArgumentException(POSITIVE_HEIGHT);
168168
}
169-
return (base1 + base2) * height / 2;
169+
return (baseLength1 + baseLength2) * height / 2;
170170
}
171171

172172
/**

0 commit comments

Comments
 (0)