11package com .thealgorithms .maths ;
22
3- /* Find volume of various shapes.*/
3+ /* Calculate the volume of various shapes.*/
44public class Volume {
55
66 /**
77 * Calculate the volume of a cube.
88 *
9- * @param sideLength side length of cube
10- * @return volume of given cube
9+ * @param sideLength length of the given cube's sides
10+ * @return volume of the given cube
1111 */
12- public static double volumeCube (double sidelength ) {
13- return sidelength * sidelength * sidelength ;
12+ public static double volumeCube (double sideLength ) {
13+ return sideLength * sideLength * sideLength ;
1414 }
1515
1616 /**
1717 * Calculate the volume of a cuboid.
1818 *
19- * @param width of cuboid
20- * @param height of cuboid
21- * @param length of cuboid
19+ * @param width width of given cuboid
20+ * @param height height of given cuboid
21+ * @param length length of given cuboid
2222 * @return volume of given cuboid
2323 */
2424 public static double volumeCuboid (double width , double height , double length ) {
@@ -28,7 +28,7 @@ public static double volumeCuboid(double width, double height, double length) {
2828 /**
2929 * Calculate the volume of a sphere.
3030 *
31- * @param radius radius of sphere
31+ * @param radius radius of given sphere
3232 * @return volume of given sphere
3333 */
3434 public static double volumeSphere (double radius ) {
@@ -38,8 +38,8 @@ public static double volumeSphere(double radius) {
3838 /**
3939 * Calculate volume of a cylinder
4040 *
41- * @param radius radius of the floor
42- * @param height height of the cylinder.
41+ * @param radius radius of the given cylinder's floor
42+ * @param height height of the given cylinder
4343 * @return volume of given cylinder
4444 */
4545 public static double volumeCylinder (double radius , double height ) {
@@ -49,7 +49,7 @@ public static double volumeCylinder(double radius, double height) {
4949 /**
5050 * Calculate the volume of a hemisphere.
5151 *
52- * @param radius radius of hemisphere
52+ * @param radius radius of given hemisphere
5353 * @return volume of given hemisphere
5454 */
5555 public static double volumeHemisphere (double radius ) {
@@ -59,9 +59,9 @@ public static double volumeHemisphere(double radius) {
5959 /**
6060 * Calculate the volume of a cone.
6161 *
62- * @param radius radius of cone.
63- * @param height of cone.
64- * @return volume of given cone.
62+ * @param radius radius of given cone
63+ * @param height of given cone
64+ * @return volume of given cone
6565 */
6666 public static double volumeCone (double radius , double height ) {
6767 return (Math .PI * radius * radius * height ) / 3 ;
@@ -70,22 +70,22 @@ public static double volumeCone(double radius, double height) {
7070 /**
7171 * Calculate the volume of a prism.
7272 *
73- * @param area of the base.
74- * @param height of prism.
75- * @return volume of given prism.
73+ * @param baseArea area of the given prism's base
74+ * @param height of given prism
75+ * @return volume of given prism
7676 */
77- public static double volumePrism (double basearea , double height ) {
78- return basearea * height ;
77+ public static double volumePrism (double baseArea , double height ) {
78+ return baseArea * height ;
7979 }
8080
8181 /**
8282 * Calculate the volume of a pyramid.
8383 *
84- * @param area of the base.
85- * @param height of pyramid.
86- * @return volume of given pyramid.
84+ * @param baseArea of the given pyramid's base
85+ * @param height of given pyramid
86+ * @return volume of given pyramid
8787 */
88- public static double volumePyramid (double basearea , double height ) {
89- return (basearea * height ) / 3 ;
88+ public static double volumePyramid (double baseArea , double height ) {
89+ return (baseArea * height ) / 3 ;
9090 }
9191}
0 commit comments