HW4 - Brittany Bosowski CSE2221 Spring 2017 HW#4 1 import...

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

Brittany Bosowski CSE2221 Spring 2017 HW#4 01/21/2017 1. import components.random.Random; import components.random.Random1L; import components.simplereader.SimpleReader; import components.simplereader.SimpleReader1L; import components.simplewriter.SimpleWriter; import components.simplewriter.SimpleWriter1L; /** * Checks whether the given point (xCoord, yCoord) is inside the circle of * radius 1.0 centered at the point (1.0, 1.0). * * @param xCoord * the x coordinate of the point * @param yCoord * the y coordinate of the point * @return true if the point is inside the circle, false otherwise */ public class MonteCarloCircle { private static boolean pointIsInCircle( double xCoord , double yCoord ) { boolean pointIsInCircle = true ; if ((( xCoord *2) + ( yCoord *2)) <= 1) { return pointIsInCircle ; } else pointIsInCircle = false ; return pointIsInCircle ; } 2. private static int numberOfPointsInCircle( int n ) { int numberofPointsInCircle = 0; int ptsInInterval = 0; int ptsInSubinterval = 0; double xCoord = 0; double yCoord = 0; boolean

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture