# ITSA E-tutor 程式碼參考(陣列5)
## [陣列 V(Array)](https://e-tutor.itsa.org.tw/e-Tutor/mod/programming/index.php?id=1630)
> [name=風思]
> 後來再補上吧!
> [color=#41e068]
> [time=Mon, Feb 17, 2020 8:50 PM]
### [C_AR203-易] 九大行星
#### Java:
```java=
import java.util.*;
//[C_AR203-易] 九大行星
//2019,08,27;22:11
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] planets = { "Mercury", "Venus", "Earth", "Mars", "Juputer", "Saturn", "Uranus", "Neptunus", "Pluto" };
int n = sc.nextInt();
sc.nextLine();
while (n-- > 0) {
int ptr = sc.nextInt();
System.out.println(ptr + " " + planets[ptr - 1]);
}
sc.close();
}
}
```
### [C_AR204-易] 十二生肖
#### Java:
```java=
import java.util.*;
//[C_AR204-易] 十二生肖
//2019,08,29;08:20
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// 西元元年(1年)屬雞
String[] zodiac = { "monkey", "rooster", "dog", "pig", "rat", "ox", "tiger", "rabbit", "dragon", "snake",
"horse", "sheep" };
int n = sc.nextInt();
while (n-- > 0) {
int year = sc.nextInt();
// 轉為西元年
int firstYear=1911;
if(year<=0)
firstYear++;
int x = (year + firstYear) % 12;
System.out.println(year + " " + zodiac[x]);
}
sc.close();
}
}
```
### [C_AR208-中] NEW START重新開始
#### Java:
```java=
import java.util.*;
//[C_AR208-中] NEW START重新開始
//2019,08,27;17:17
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
sc.nextLine();
while (n-- > 0) {
String str = sc.nextLine();
switch (str) {
case "N":
System.out.println("N: Nutrition");
break;
case "E":
System.out.println("E: Exercise");
break;
case "W":
System.out.println("W: Water");
break;
case "S":
System.out.println("S: Sun");
break;
case "T":
System.out.println("T: Temper");
break;
case "A":
System.out.println("A: Air");
break;
case "R":
System.out.println("R: Rest");
break;
case "t":
System.out.println("t: trust");
break;
}
}
sc.close();
}
}
```
### [C_AR209-中] 兵聖
#### Java:
```java=
import java.util.*;
//[C_AR209-中] 兵聖
//2019,08,27;19:56
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
sc.nextLine();
String[][] date = new String[n][3];
for (int i = 0; i < n; i++)
date[i] = sc.nextLine().split(" ");
for (int i = 0; i < n; i++) {
int trait_1 = Integer.parseInt(date[i][1]);
int trait_2 = Integer.parseInt(date[i][2]);
if (trait_1 == 1 && trait_2 == 4)
System.out.println(date[i][0] + " General");
else if (trait_1 == 1 && trait_2 == 3) {
System.out.println(date[i][0] + " Staff");
} else if (trait_1 == 2 && trait_2 == 4) {
System.out.println(date[i][0] + " Soldier");
} else
System.out.println(date[i][0] + " execute by shooting");
}
sc.close();
}
}
```
### [C_AR210-易] 簡易加密
#### Java:
```java=
import java.util.*;
//[C_AR210-易] 簡易加密
//2019,08,26;23:17
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
sc.nextLine();
int count = 0;
while (count < n) {
char chr = sc.nextLine().charAt(0);
System.out.printf("%c\n", chr + 2);
count++;
}
sc.close();
}
}
```
###### tags: `e tutor` `陣列 V(Array)`