63 838
Assignments Done
99,2%
Successfully Done
In August 2018

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
Expert's answer
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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions