CSE2221 #4.docx - 1 private static boolean...

This preview shows page 1 out of 1 page.

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

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture