Advertisement
desislava_topuzakova

6. Point on Rectangle Border

May 13th, 2018
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class PointOnRectangle  {
  4.     public static void main(String[] agrs) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double x1 = Double.parseDouble(scanner.nextLine());
  8.         double y1 = Double.parseDouble(scanner.nextLine());
  9.         double x2 = Double.parseDouble(scanner.nextLine());
  10.         double y2 = Double.parseDouble(scanner.nextLine());
  11.         double x = Double.parseDouble(scanner.nextLine());
  12.         double y = Double.parseDouble(scanner.nextLine());
  13.  
  14.         boolean check1= (x == x1 || x == x2);
  15.         boolean check2= (y >= y1 && y <= y2);
  16.         boolean check3= (y == y1 || y == y2);
  17.         boolean check4= (x >= x1 && x <= x2);
  18.  
  19.         if ((check1 && check2) || (check3 && (check4))) {
  20.             System.out.println("Border");
  21.         } else {
  22.             System.out.println("Inside / Outside");
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement