Advertisement
Guest User

03. Points inside a Figure

a guest
Aug 27th, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class _03_PointsInsideFigure {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         double x = scanner.nextDouble();
  7.         double y = scanner.nextDouble();
  8.  
  9.         boolean isInsideFirstFigure = (x >= 12.5 && x <= 17.5)
  10.                                       && (y >= 8.5 && y <= 13.5);
  11.  
  12.         boolean isInsideSecondFigure = (x >= 20 && x <= 22.5)
  13.                                       && (y >= 8.5 && y <= 13.5);
  14.  
  15.         boolean isInsideThirdFigure = (x >= 12.5 && x <= 22.5)
  16.                                       && (y >= 6 && y <= 8.5);
  17.  
  18.  
  19.         if (isInsideFirstFigure || isInsideSecondFigure || isInsideThirdFigure) {
  20.             System.out.println("Inside");
  21.         }
  22.         else {
  23.             System.out.println("Outside");
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement