Advertisement
tchenkov

L04u03_PointInRectangle

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