diff --git a/.idea/misc.xml b/.idea/misc.xml index d15472f..2f755b0 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/ArchimedesPiMethod.java b/src/ArchimedesPiMethod.java index 0b6e780..fdf13a8 100644 --- a/src/ArchimedesPiMethod.java +++ b/src/ArchimedesPiMethod.java @@ -2,6 +2,18 @@ public class ArchimedesPiMethod { public static void main(String[] args) { - + int n = 8; + double B = 360.0 / n; + double A = 0.5 * B; + double AInRadians = Math.toRadians(A); + double s = 2 * Math.sin(AInRadians); + double p = n * s; + double piEstimate = p / 2; + System.out.println("Number of sides (n): " + n); + System.out.println("Angle B: " + B + " degrees"); + System.out.println("Angle A: " + A + " degrees"); + System.out.println("Length of 1 triangle base (s): " + s); + System.out.println("Polygon perimeter (p): " + p); + System.out.println("Estimated value of Pi (PI): " + piEstimate); } }