Advertisement
mahitsy

Inside/Outside or Border

Jan 21st, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.95 KB | None | 0 0
  1. package my.company;
  2.  
  3.  
  4. import java.util.Scanner;
  5.  
  6. public class Main {
  7.  
  8.     public static void main(String[] args) {
  9.         Scanner console = new Scanner(System.in);
  10.  
  11.         double x1 = Double.parseDouble(console.nextLine());
  12.         double y1 = Double.parseDouble(console.nextLine());
  13.         double x2 = Double.parseDouble(console.nextLine());
  14.         double y2 = Double.parseDouble(console.nextLine());
  15.         double x = Double.parseDouble(console.nextLine());
  16.         double y = Double.parseDouble(console.nextLine());
  17.  
  18.         boolean isInside = ((x > x1) && (x < x2)) && ((y > y1) && (y < y2));
  19.         boolean Border = (((x == x1 || x == x2) && (y >= y1) && (y <= y2)) || ((y == y1 || y == y2) && (x >= x1) && (x <= x2)));
  20.  
  21.         if (isInside){
  22.             System.out.println("Inside");
  23.         } else if (Border){
  24.             System.out.println("Border");
  25.         } else {
  26.             System.out.println("Outside");
  27.         }
  28.  
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement