Skip to content

Commit f1fd8c1

Browse files
Add Function volumeFrustumOfCone To Calculate Frustum Of Cone Then Test It.
1 parent d89416d commit f1fd8c1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public static double volumePyramid(double baseArea, double height) {
9999
* @param height height of the frustum
100100
* @return volume of the frustum
101101
*/
102-
public static double volumeFrustum(double r1, double r2, double height) {
102+
public static double volumeFrustumOfCone(double r1, double r2, double height) {
103103
return (Math.PI * height / 3) * (r1 * r1 + r2 * r2 + r1 * r2);
104104
}
105105

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void volume() {
3434
assertTrue(Volume.volumePyramid(10, 3) == 10.0);
3535

3636
/* test frustum */
37-
assertTrue(Volume.volumeFrustum(3, 5, 7) == 359.188760060433);
37+
assertTrue(Volume.volumeFrustumOfCone(3, 5, 7) == 359.188760060433);
3838

3939
}
40-
}
40+
}

0 commit comments

Comments
 (0)