Advertisement
galinyotsev123

ProgBasicsJavaBook4.1ComplexConditions06PointOnRectangleBor

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