SStoyanov22

Untitled

Sep 11th, 2014
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class PointsInsideTheHouse {
  5.  
  6. public static void main(String[] args) {
  7. // TODO Auto-generated method stub
  8. Scanner sc = new Scanner(System.in);
  9. String input = sc.nextLine();
  10. String[] xy = input.split(" ");
  11. double x = Double.parseDouble(xy[0]);
  12. double y = Double.parseDouble(xy[1]);
  13. if (x>=12.5 && x<=17.5 && y>=3.5 && y<=8.5 && x + y>=21) { //First figure (left half of the roof) equations
  14. System.out.println("Inside");
  15. }
  16. else if (x>=17.5 && x<=22.5 && y>=3.5 && y<=8.5 && x - y <= 14) {//Second figure (right half of the roof) equations
  17. System.out.println("Inside");
  18. }
  19. else if (x>=12.5 && x<=17.5 && y>=8.5 && y<=13.5) { //Third figure equations
  20. System.out.println("Inside");
  21. }
  22. else if (x>=20 && x<=22.5 && y>=8.5 && y<=13.5) { //Fourth figure equations
  23. System.out.println("Inside");
  24. }
  25. else {
  26. System.out.println("Outside");
  27. }
  28. }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment