Answer to Question #28395 in Java | JSP | JSF for temesgen derejaw

Question #28395
write aprogram that prompts the user to enter a point (x,y)and checks whether the point is within the circle centered at (0,0)is radius 10
1
Expert's answer
2013-04-16T10:26:36-0400
import java.io.*;
import java.util.Scanner;

class PointInCircle
{

public static void main(String args[])
{
& Scanner sc = new Scanner( System.in );
& double x,y;
&
& System.out.printf("Enter coordinates of the point:\n");
& System.out.printf("x : ");
& x = sc.nextDouble();
& System.out.printf("y : ");
& y = sc.nextDouble();
&
& if ( x*x + y*y <= 100 )
& {
System.out.printf("Point (%f,%f) is inside the circle of radius 10\n",x,y);
& }
& else
& {
System.out.printf("Point (%f,%f) is outside the circle of radius 10\n",x,y); &
& }
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS