Skip to content

Commit 1c8bdd9

Browse files
committed
Merge branch 'mcoloring_improvement' of https://github.com/Hardvan/Java into mcoloring_improvement
2 parents 823eab1 + 9c2a441 commit 1c8bdd9

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
<dependency>
119119
<groupId>com.puppycrawl.tools</groupId>
120120
<artifactId>checkstyle</artifactId>
121-
<version>10.18.1</version>
121+
<version>10.18.2</version>
122122
</dependency>
123123
</dependencies>
124124
</plugin>
@@ -133,7 +133,7 @@
133133
<plugin>
134134
<groupId>com.mebigfatguy.fb-contrib</groupId>
135135
<artifactId>fb-contrib</artifactId>
136-
<version>7.6.4</version>
136+
<version>7.6.5</version>
137137
</plugin>
138138
<plugin>
139139
<groupId>com.h3xstream.findsecbugs</groupId>

spotbugs-exclude.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@
165165
<Match>
166166
<Bug pattern="DSOC_DUBIOUS_SET_OF_COLLECTIONS" />
167167
</Match>
168-
<Match>
169-
<Bug pattern="NAB_NEEDLESS_BOX_TO_UNBOX" />
170-
</Match>
171168
<Match>
172169
<Bug pattern="FPL_FLOATING_POINT_LOOPS" />
173170
</Match>
@@ -207,6 +204,9 @@
207204
<Match>
208205
<Bug pattern="SLS_SUSPICIOUS_LOOP_SEARCH" />
209206
</Match>
207+
<Match>
208+
<Bug pattern="BAS_BLOATED_ASSIGNMENT_SCOPE" />
209+
</Match>
210210
<!-- find-sec-bugs -->
211211
<Match>
212212
<Bug pattern="PREDICTABLE_RANDOM" />

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,16 @@ public static double volumePrism(double baseArea, double height) {
9090
public static double volumePyramid(double baseArea, double height) {
9191
return (baseArea * height) / 3;
9292
}
93+
94+
/**
95+
* Calculate the volume of a frustum of a cone.
96+
*
97+
* @param r1 radius of the top of the frustum
98+
* @param r2 radius of the bottom of the frustum
99+
* @param height height of the frustum
100+
* @return volume of the frustum
101+
*/
102+
public static double volumeFrustumOfCone(double r1, double r2, double height) {
103+
return (Math.PI * height / 3) * (r1 * r1 + r2 * r2 + r1 * r2);
104+
}
93105
}

src/test/java/com/thealgorithms/maths/VolumeTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,8 @@ public void volume() {
3232

3333
/* test pyramid */
3434
assertTrue(Volume.volumePyramid(10, 3) == 10.0);
35+
36+
/* test frustum */
37+
assertTrue(Volume.volumeFrustumOfCone(3, 5, 7) == 359.188760060433);
3538
}
3639
}

src/test/java/com/thealgorithms/misc/MedianOfRunningArrayTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,6 @@ public void testWithDoubleValues() {
196196
stream.insert(12345.67891);
197197
assertEquals(12345.67891, stream.median());
198198
stream.insert(23456789.98);
199-
assertEquals(Double.valueOf(11734567.83), stream.median(), .01);
199+
assertEquals(11734567.83, stream.median(), .01);
200200
}
201201
}

0 commit comments

Comments
 (0)