Answer to Question #28395 in Java | JSP | JSF for temesgen derejaw
2013-04-12T15:52:52-04:00
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
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 !
Learn more about our help with Assignments:
Java JSP JSF
Comments
Leave a comment