Advertisement
Guest User

03. Point in Rectangle

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