Advertisement
nadiahristova

Prob3_PointsInsideFigure

Jan 24th, 2015
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Prob3_PointsInsideFigure {
  4.     public static void main(String[] args) {
  5.         Scanner input = new Scanner(System.in);
  6.        
  7.         System.out.print("Enter the coordinates of a point: ");
  8.         float x = input.nextFloat();
  9.         float y = input.nextFloat();
  10.        
  11.         boolean isInBigRec = x >= 12.5 && x<=22.5 && y>=6 && y<=13.5;
  12.         boolean isInEmptyRec = x > 17.5 && x<20 && y>8.5 && y<13.5;
  13.        
  14.         if (isInBigRec ^ isInEmptyRec) {
  15.             System.out.println("Inside");
  16.         } else {
  17.             System.out.println("Outside");
  18.         }      
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement