Last active
May 24, 2017 05:17
-
-
Save peter279k/e3bbbef303bbf1024ad011005d38abf2 to your computer and use it in GitHub Desktop.
TQC+ JAVA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class JPA02 { | |
static Scanner keyboard = new Scanner(System.in); | |
public static void main(String[] args) { | |
test(); | |
test(); | |
test(); | |
test(); | |
} | |
public static void test() { | |
System.out.print("請輸入x座標: "); | |
double x = keyboard.nextDouble(); | |
System.out.print("請輸入y座標: "); | |
double y = keyboard.nextDouble(); | |
if(x == 0 && y == 0) { | |
System.out.println("(" + x + "," + y + ") 在原點上"); | |
} | |
if(x == 0 && (y > 0 || y < 0)) { | |
System.out.println("(" + x + "," + y + ") 在y軸上"); | |
} | |
if(y == 0 && (x > 0 || x > 0)) { | |
System.out.println("(" + x + "," + y + ") 在x軸上"); | |
} | |
if(x > 0 && y > 0) { | |
System.out.println("(" + x + "," + y + ") 在第一象限"); | |
} | |
if(x < 0 && y > 0) { | |
System.out.println("(" + x + "," + y + ") 在第二象限"); | |
} | |
if(x < 0 && y < 0) { | |
System.out.println("(" + x + "," + y + ") 在第三象限"); | |
} | |
if(x > 0 && y < 0) { | |
System.out.println("(" + x + "," + y + ") 在第四象限"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment