vstoyanov

Оператори и Изрази 9

May 12th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. import org.omg.CORBA.MARSHAL;
  2. import org.omg.Messaging.SYNC_WITH_TRANSPORT;
  3.  
  4. import java.util.Scanner;
  5.  
  6. public class Main {
  7.  
  8.     public static void main(String[] args) {
  9.         Scanner scanner=new Scanner (System.in);
  10.  
  11.         boolean hasInsideCircle=false;
  12. boolean hasOutsideTriangle=false;
  13.            Double x=Double.parseDouble(scanner.nextLine());
  14.         Double y=Double.parseDouble(scanner.nextLine());
  15.  
  16.         Double x1=-1.0;
  17.         Double x2=5.0;
  18.         Double y1=1.0;
  19.         Double y2=5.0;
  20.  
  21. int radius=5;
  22.  
  23. double dx=Math.abs(x-0);
  24. double dy= Math.abs(y-0);
  25.  
  26.  
  27.         if(dx*dx+dy*dy<=radius*radius)
  28.         {
  29.  
  30.             hasInsideCircle=true;
  31.         }
  32.  
  33.         if ((x1 <= x && x2 >= x) && ((y1 <= y && y2 >= y)))
  34.         {
  35.             hasOutsideTriangle=false;
  36.         }else {
  37.             hasOutsideTriangle=true;
  38.         }
  39.  
  40.  
  41.         System.out.println(hasInsideCircle);
  42.         System.out.println(hasOutsideTriangle);
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment