borkins

06. Point on Rectangle Border

Mar 26th, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1. /**
  2.  * Project: Complex_Conditions - created by borkins on 2017-03-26.
  3.  */
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class _06_PointOnRectangleBorder
  8. {
  9.     public static void main(String[] args)
  10.     {
  11.         Scanner console = new Scanner(System.in);
  12.        
  13.         double x1 = Double.parseDouble(console.nextLine());
  14.         double y1 = Double.parseDouble(console.nextLine());
  15.         double x2 = Double.parseDouble(console.nextLine());
  16.         double y2 = Double.parseDouble(console.nextLine());
  17.         double pX = Double.parseDouble(console.nextLine());
  18.         double pY = Double.parseDouble(console.nextLine());
  19.        
  20.        boolean onBorder = (pX == x1 || pX == x2) && (pY >= y1 && pY <= y2)
  21.                         || (pY == y1 || pY == y2) && (pX >= x1 && pX <= x2);
  22.        
  23.         System.out.println((onBorder) ? "Border" : "Inside / Outside");
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment