- package test;
- import java.util.Scanner;
- public class JPA02 {
- static Scanner keyboard = new Scanner(System.in);
- public static void main(String[] args) {
-
- // TODO 自動產生的方法 Stub
- test();
- test();
- test();
- test();
- }
- static void test() {
- System.out.print("請輸入x座標 : ");
- int x=keyboard.nextInt();
- System.out.print("請輸入y座標 : ");
- int y=keyboard.nextInt();
-
- if(x>0)
- {
- if(y>0)
- {
- System.out.println("座標值+在第一象限");
- }
- else if(y<0)
- {
- System.out.println("座標值+在第四象限");
- }
- else
- {
- System.out.println("座標值+在x軸上");
- }
- }
- else if(x<0)
- {
- if(y>0)
- {
- System.out.println("座標值+在第二象限");
- }
- else if(y<0)
- {
- System.out.println("座標值+在第三象限");
- }
- else
- {
- System.out.println("座標值+在y軸上");
- }
-
- }
- else{
- if(y==0)
- {
- System.out.println("座標值+在原點上");
- }
- else{
- System.out.println("座標值+在y軸上");
- }
- }
- }
- }
複製代碼 |