Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class PointonRectangleBorder {
  4. public static void main(String[] args) {
  5. Scanner scan = new Scanner(System.in);
  6. double x1 = Double.parseDouble(scan.nextLine());
  7. double y1 = Double.parseDouble(scan.nextLine());
  8. double x2 = Double.parseDouble(scan.nextLine());
  9. double y2 = Double.parseDouble(scan.nextLine());
  10. double x = Double.parseDouble(scan.nextLine());
  11. double y = Double.parseDouble(scan.nextLine());
  12.  
  13. boolean check1 = (x == x1) || (x == x2) && (y >= y1 && y <= y2);
  14. boolean check2 = (y == y1) || (y == y2) && (x >= x1 && x <= x2);
  15. if (check1 || check2){
  16. System.out.println("Border"); }else System.out.println("Inside / Outside");
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement