Hw 4 - CSE 2221 Hw#4 Tue/Thur 1:50 pm 2:45 pm 1 private...

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

CSE 2221 Hw #4 Tue/Thur 1:50 pm – 2:45 pm 1/26/16 1. private static boolean pointIsInCircle( double xCoord , double yCoord ) { boolean check = false ; double distance = ( xCoord - 1) * ( xCoord - 1) + ( yCoord - 1) * ( yCoord - 1); if ( distance <= 1) { check = true ; return check ; } return check ; } 2. private static int numberOfPointsInCircle( int n ) { Random rnd = new Random1L(); int i = 0, counter = 0; while ( i < n ) { double x = rnd .nextDouble() * 2; double y = rnd .nextDouble() * 2; if ( pointIsInCircle ( x , y )) { counter ++; } i ++; } return

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture