Advertisement
Guest User

Point on rectangle

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