Homework 4 - CSE2221 Simon Chen 10:20 am Prof Boggus...

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

CSE2221 Simon Chen 10:20 am Prof. Boggus Homework 4 Homework: Static Methods 1. Implement (i.e., provide the code for the body of) the static method declared as  follows: 1 2 3 4 5 6 7 8 9 1 0 11 1 2 1 3 /** * 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 */ private static boolean pointIsInCircle(double xCoord, double yCoord) { ... } /** * * 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 */ private static boolean pointIsInCircle(double xCoord, double yCoord) { //To declare a temp value for the parameters. double xTemp = xCoord, yTemp = yCoord; boolean circle = false; //To determine whether the point in in the circle. if ((xTemp - 1) * (xTemp - 1) + (yTemp - 1) * (yTemp - 1) <= 1.0) { circle = true; } return circle; }

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture