Advertisement
AlexKondov

Java Points Inside a Figure

May 13th, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class PointsInsideAFigure {
  5.  
  6.     public static void main(String[] args) {
  7.         Scanner input = new Scanner(System.in);
  8.         double x = input.nextDouble();
  9.         double y = input.nextDouble();
  10.        
  11.         if (x >= 12.5 && x <= 22.5) {
  12.             if (y >= 6 && y <= 8.5) {
  13.                 System.out.println("Inside");
  14.             }
  15.             else if (x >= 12.5 && x <= 17.5) {
  16.                 if (y >= 6 && y <= 13.5) {
  17.                     System.out.println("Inside");
  18.                 }
  19.                 else {
  20.                     System.out.println("Outside");
  21.                 }
  22.             }
  23.             else if (x >= 20 && x <= 22.5) {
  24.                 if (y >= 6 && y <= 13.5) {
  25.                     System.out.println("Inside");
  26.                 }
  27.                 else {
  28.                     System.out.println("Outside");
  29.                 }
  30.             }
  31.             else {
  32.                 System.out.println("Outside");
  33.             }
  34.         }
  35.         else if (x < 12.5 || x > 22.5) {
  36.             System.out.println("Outside");
  37.         }
  38.  
  39.     }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement