Homework 4.docx - Vijay Magat CSE 2221 9.8.20 Homework 4 1...

This preview shows page 1 out of 1 page.

Vijay Magat CSE 2221 9.8.20 Homework 4 1. private statc boolean pointIsInCircle (double xCoord, double yCoord) { boolean inCircle = false; if (Math.pow((xCoord – 1), 2) + Math.pow((yCoord – 1), 2) <= 1) { inCircle = true; } Return inCircle; } 2. private statc int numberOfPointsInCircle (int n) { int point = 0; int pointInCircle = 0; while (point < n) { double xCoord = Math.random() * 2; double yCoord = Math.random() * 2;

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture