Homework 4.docx - import components.random.Random import...

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

import components.random.Random; import components.random.Random1L; import components.simplereader.SimpleReader; import components.simplereader.SimpleReader1L; import components.simplewriter.SimpleWriter; import components.simplewriter.SimpleWriter1L; /** * Put a short phrase describing the program here. * * @author Put your name here * */ public final class Homework4 { /** * Private constructor so this utility class cannot be instantiated. */ private Homework4() { } /** * 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) { double d = Math.pow( Math.pow(1.0 - xCoord, 2.0) + Math.pow(1.0 - yCoord, 2.0), 1.0 / 2.0); return d < 1; } /** * Generates n pseudo-random points in the [0.0,2.0) x [0.0,2.0) square and

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture