q5-1完了

This commit is contained in:
2026-09-11 16:47:58 +09:00
parent 6dcc784838
commit bac3c76248
4 changed files with 46 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

1
Question05-switch/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/bin/

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Question05-switch</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -21,7 +21,28 @@ public class PTra05_01 {
* 変数numの値が 2 の場合 -> あなたの運勢は「中吉」です * 変数numの値が 2 の場合 -> あなたの運勢は「中吉」です
* 変数numの値が 3 の場合 -> あなたの運勢は「小吉」です * 変数numの値が 3 の場合 -> あなたの運勢は「小吉」です
* 変数numの値が 4 の場合 -> あなたの運勢は「末吉」です * 変数numの値が 4 の場合 -> あなたの運勢は「末吉」です
* 変数numの値が 5 の場合 -> あなたの運勢は「凶」です * 変数numの値が 5 の場合 -> あなたの運勢は「末吉」です
*/ */
switch(num) {
case 0 :
System.out.println("あなたの運勢は「大吉」です");
break;
case 1 :
System.out.println("あなたの運勢は「吉」です");
break;
case 2 :
System.out.println("あなたの運勢は「中吉」です");
break;
case 3 :
System.out.println("あなたの運勢は「小吉」です");
break;
case 4 :
System.out.println("あなたの運勢は「末吉」です");
break;
case 5 :
System.out.println("あなたの運勢は「末吉」です");
break;
}
} }
} }