URI Problem (Coordinates of a Point) 1041 Solution in Java

Problem Solving, URI

URI Problem (Coordinates of a Point) 1041:
Coordinates of a Point is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.

import java.util.Scanner;

/**
 * @Author : Muhammad Harun-Or-Roshid
 * @Date   : Oct 10, 2016
 * @Time   : 9:56:05 PM
 */
public class Uri1041 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double x,y;
        x = sc.nextDouble();
        y = sc.nextDouble();
        if(x!=0 && y==0){
            System.out.println("Eixo X");
        }else if(x==0 && y!=0){
            System.out.println("Eixo Y");
        }else if(x == 0 && y ==0){
            System.out.println("Origem");
        }else if(x>0 && y>0){
            System.out.println("Q1");
        }else if(x<0 && y>0){
            System.out.println("Q2");
        }else if(x<0 && y<0){
            System.out.println("Q3");
        }else if(x>0 && y<0){
            System.out.println("Q4");
        }else{
            
        }
    }
}

0 Comments

You may find interest following article