/* Given a circle of an input radius whose center is at point 0,0, we input an x,y coordinate * from the user and determine if that coordinate lies on the circle, inside it or outside it. * We need to compute the distance from 0,0 to x,y and compare it to radius. But given that * we are dealing with doubles, to lie on the circle itself we need a small error amount for * loss of precision so we say that the point lies on the circle if the distance - radius is * less than some small value, EPSILON */ import java.util.Scanner; public class Ch4_Circle_Point { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter the radius of your circle "); // input the radius, x and y all as doubles double radius = in.nextDouble(); System.out.print("Enter the x-coordinate of a point "); double x = in.nextDouble(); System.out.print("Enter the y-coordinate of a point "); double y = in.nextDouble(); final double EPSILON = 0.0000001; // use this for possible loss of precision double distance = Math.sqrt(x*x + y*y); // the distance from x,y to the center, at 0,0 if(Math.abs(distance-radius)