Advertisement
angeles734

MEJORADEL01

Aug 27th, 2020 (edited)
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.50 KB | None | 0 0
  1. package ejercicio1Completo;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class terminado{
  6.  
  7.     public static void main(String[] args) {
  8.         // TODO Auto-generated method stub
  9.          String eje = "";
  10.             Scanner valor=new Scanner (System.in);
  11.        try {
  12.            System.out.println("Ingrese el valor de X");
  13.             int X = valor.nextInt();
  14.              
  15.             System.out.println("Ingrese el valor de Y");
  16.             int Y = valor.nextInt();
  17.              
  18.             if (X>0 && Y>0) {
  19.                 System.out.println("el punto pertenece al primer cuadrante I");
  20.                
  21.             } else
  22.                
  23.                 if (X<0 && Y>0) {
  24.                 System.out.println("el punto pertenece al segundo  cuadrante II");
  25.             }else
  26.                 if (X<0 && Y>0) {
  27.                 System.out.println("el punto pertenece al tercer cuadrante III");
  28.                
  29.             }else
  30.                
  31.             if (X>0 && Y<0) {
  32.                 System.out.println("el punto pertenece al cuarto cuadrante IV");
  33.                
  34.             }else
  35.                 if (X==0 && Y==0) {
  36.                 System.out.println("el punto pertenece al  origen de coordenadas");
  37.                
  38.             }else
  39.                  if (Y!=0) {
  40.                  if (Y>0) {
  41.                  eje=" Y positivo";
  42.              } else
  43.                  eje=" Y negativo";
  44.                   }
  45.                      
  46.                   if (X!=0) {
  47.                    if (X>0) {
  48.                    eje=" X positivo";
  49.               } else
  50.               {      eje=" X negativo";
  51.                              }
  52.                           }
  53.                    
  54.     System.out.println ("El punto (" + X + "," + Y + ") pertenece al  eje"+ eje);
  55.            
  56.     } catch (Exception e) {
  57.          System.out.println("se produjo un error INGRESE CORRECTAMENTE LOS VALORES");
  58.     }
  59.     }
  60. }
  61.    
  62.    
  63.        
  64.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement