-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPerimeter_Calc.java
More file actions
40 lines (35 loc) · 1.01 KB
/
Perimeter_Calc.java
File metadata and controls
40 lines (35 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package geometry;
/**
* Class: Perimeter_Calc
* Description: Part of the 'geometry' package.
* Contains methods to calculate the perimeter of different shapes.
* Author: Amey Thakur
* Reference: https://github.com/Amey-Thakur/OOPM-JAVA-LAB
*/
public class Perimeter_Calc {
/**
* Calculate perimeter of a square.
* @param side Side length of the square
* @return Perimeter of the square
*/
public int perisquare(int side) {
return 4 * side;
}
/**
* Calculate perimeter of a rectangle.
* @param length Length of the rectangle
* @param breadth Breadth of the rectangle
* @return Perimeter of the rectangle
*/
public int perirect(int length, int breadth) {
return 2 * (length + breadth);
}
/**
* Calculate perimeter of a circle.
* @param radius Radius of the circle
* @return Circumference (perimeter) of the circle
*/
public float pericircle(float radius) {
return 2 * 3.14f * radius;
}
}