Untitled

 avatar
unknown
java
2 years ago
991 B
4
Indexable
package AssignTwo;
import java.util.*;

public class QuestionOne
{
    public static boolean checkPt(int x, int y , int r, int h)
    {
        double value  = Math.pow(x-h, 2) + Math.pow(y-h, 2);
        if(value == Math.pow(r, 2))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    public static void main(String[] args) 
    {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Please enter the x-coordinate");
        int x =  scanner.nextInt();
        System.out.println("Please enter theyx-coordinate");
        int y =  scanner.nextInt();
        int r = 2; 
        int h = 5; 
        boolean result = checkPt(x,y,r,h);
        if(result == true)
        {
            System.out.printf("The point with (%d,%d) lies on the circle", x, y);
        }
        else
        {
            System.out.printf("The point with (%d,%d) does not lie on the circle", x, y);
        }
        
    }


}
Editor is loading...