返回列表 發帖
package jihgh;

import java.util.Scanner;

public class dbxdbff {
        static Scanner k = new Scanner(System.in);
   
        
        public static void main(String[] args) {
                // TODO 自動產生的方法 Stub

                test();        
        test();
        test();
        test();
       
        }
        private static void test() {
                System.out.print("請輸入艾克斯和歪");
                double x=k.nextDouble();
                double y=k.nextDouble();
       
               


                if(x>0)
                {
                        if(y<0)
                        {
                                System.out.printf("<%.2f,%.2f>在第四象限",x,y);
                        }
                        else if(y>0)
                        {
                                System.out.printf("<%.2f,%.2f>在第一象限",x,y);
                        }
                        else if(y==0)
                        {
                                System.out.printf("<%.2f,%.2f>在x軸",x,y);
                        }
                }
                        if(x<0)
                        {
                                if(y<0)
                                {
                                        System.out.printf("<%.2f,%.2f>在第三象限",x,y);
                                }
                                else if(y>0)
                                {
                                        System.out.printf("<%.2f,%.2f>在第二象限",x,y);
                                }
                                else if(y==0)
                                {
                                        System.out.printf("<%.2f,%.2f>在x軸",x,y);
                               
                               
                                }
                        }
                               
                        else if(x==0)       
                {                               
                if(y>0 ||y<0)
        {
                System.out.printf("<%.2f,%.2f>在y軸",x,y);
        }
                else if(y==0)
        {
                System.out.printf("<%.2f,%.2f>在原點",x,y);
        }       
                }
                }}

TOP

返回列表