HW4.pdf - 1 private static boolean pointIsInCircle(double...

This preview shows page 1 - 3 out of 3 pages.

1. private static boolean pointIsInCircle(double xCoord, double yCoord) { boolean radius = false; if ((xCoord-1.0)*(xCoord-1.0) + (yCoord-1.0)*(yCoord-1.0) < 1.0) { radius = true; } else { return circle; } } 2. private static int numberOfPointsInCircle(int n) { int hits = 0; for (int i =0; i <= n; i++) { Random rnd = new Random1L(); double x = rnd.nextDouble()*2.0; rnd = new Random1L(); double y = rnd.nextDouble()*2.0;

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture